net.algart.math.functions.CoordinateTransformationOperator Maven / Gradle / Ivy
Show all versions of algart Show documentation
/*
* The MIT License (MIT)
*
* Copyright (c) 2007-2024 Daniel Alievsky, AlgART Laboratory (http://algart.net)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.algart.math.functions;
/**
* Coordinate transformation operator in n-dimensional Euclidean space:
* g(x) = O f(x) = f(map(x)),
* where x is a point of the n-dimensional space,
* map is some mapping of this space, f is the source mathematical function
* and g is the result of applying the operator to f.
* The mapping is fully defined by the basic method of this interface,
* {@link #map(double[] destPoint, double[] srcPoint)},
* that transforms the original point to the new point.
*
* Implementations of this interface are usually immutable and
* always thread-safe: {@link #map map} method of this interface may be freely used
* while simultaneous accessing the same instance from several threads.
* All implementations of this interface from this package are immutable.
*
* @author Daniel Alievsky
*/
public interface CoordinateTransformationOperator extends Operator {
/**
* Transforms the coordinates srcPoint
of the original point in n-dimensional space
* to the coordinates destPoint
of the destination point.
* Usually destPoint.length
must be equal
* to srcPoint.length
(the number of dimensions),
* but this requirement is not strict.
*
* This method must not modify srcPoint
array.
*
*
Warning: this method will probably not work correctly if
* destPoint
and srcPoint
* is the same Java array!
*
* @param destPoint the coordinates of the destinated point y, filled by this method.
* @param srcPoint the coordinates of the source point x.
* @throws NullPointerException if one of the arguments is {@code null}.
* @throws IllegalArgumentException if destPoint.length!=srcPoint.length
* (may be not thrown by some implementations,
* or may be thrown in other situations).
*/
void map(double[] destPoint, double[] srcPoint);
/**
* In this interface, this method is equivalent to
* {@link CoordinateTransformedFunc#getInstance(Func, CoordinateTransformationOperator)
* CoordinateTransformedFunc.getInstance(f, this)}.
*
* @param f the parent function, the arguments of which will be mapped by this operator.
* @return new transformed function.
*/
Func apply(Func f);
/**
* Returns the hash code of this object. The result depends on all parameters, specifying
* coordinate transformation, performed by this operator.
*
* @return the hash code of this operator.
*/
int hashCode();
/**
* Indicates whether some other object is also a {@link CoordinateTransformationOperator
* coordinate transformation operator}, performing the same coordinate transformation as this one.
*
*
There is high probability, but no guarantee that this method returns true
if the passed operator
* specifies a transformation, identical to this one.
* There is a guarantee that this method returns false
* if the passed operator specifies a transformation, different from this one.
*
* @param obj the object to be compared for equality with this operator.
* @return true
if the specified object is a coordinate transformation operator equal to this one.
*/
boolean equals(Object obj);
}