Class AbstractAffineTransformMatrix<V extends EuclideanVector<V>,M extends AbstractAffineTransformMatrix<V,M>>
- java.lang.Object
-
- org.apache.commons.geometry.euclidean.AbstractAffineTransformMatrix<V,M>
-
- Type Parameters:
V- Vector/point implementation type defining the space.M- Matrix transform implementation type.
- All Implemented Interfaces:
java.util.function.Function<V,V>,java.util.function.UnaryOperator<V>,Transform<V>,EuclideanTransform<V>
- Direct Known Subclasses:
AffineTransformMatrix1D,AffineTransformMatrix2D,AffineTransformMatrix3D
public abstract class AbstractAffineTransformMatrix<V extends EuclideanVector<V>,M extends AbstractAffineTransformMatrix<V,M>> extends java.lang.Object implements EuclideanTransform<V>
Base class for affine transform matrices in Euclidean space.
-
-
Constructor Summary
Constructors Constructor Description AbstractAffineTransformMatrix()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract VapplyDirection(V vec)Apply this transform to the given vector, ignoring translations and normalizing the result.abstract doubledeterminant()Get the determinant of the matrix.abstract Minverse()Get an instance representing the inverse transform.abstract Mlinear()Return a matrix containing only the linear portion of this transform.abstract MlinearTranspose()Return a matrix containing the transpose of the linear portion of this transform.MnormalTransform()Return a transform suitable for transforming normals.booleanpreservesOrientation()Return true if the transform preserves the orientation of the space.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.geometry.euclidean.EuclideanTransform
applyVector
-
-
-
-
Method Detail
-
applyDirection
public abstract V applyDirection(V vec)
Apply this transform to the given vector, ignoring translations and normalizing the result. This is equivalent totransform.applyVector(vec).normalize()but without the intermediate vector instance.- Parameters:
vec- the vector to transform- Returns:
- the new, transformed unit vector
- Throws:
java.lang.IllegalArgumentException- if the transformed vector coordinates cannot be normalized- See Also:
EuclideanTransform.applyVector(EuclideanVector)
-
determinant
public abstract double determinant()
Get the determinant of the matrix.- Returns:
- the determinant of the matrix
-
inverse
public abstract M inverse()
Get an instance representing the inverse transform.- Specified by:
inversein interfaceTransform<V extends EuclideanVector<V>>- Returns:
- an instance representing the inverse transform
- Throws:
java.lang.IllegalStateException- if the matrix cannot be inverted
-
linear
public abstract M linear()
Return a matrix containing only the linear portion of this transform. The returned instance contains the same matrix elements as this instance but with the translation component set to zero.- Returns:
- a matrix containing only the linear portion of this transform
-
linearTranspose
public abstract M linearTranspose()
Return a matrix containing the transpose of the linear portion of this transform. The returned instance is linear, meaning it has a translation component of zero.- Returns:
- a matrix containing the transpose of the linear portion of this transform
-
normalTransform
public M normalTransform()
Return a transform suitable for transforming normals. The returned matrix is the inverse transpose of the linear portion of this instance, i.e.N = (L-1)T, whereLis the linear portion of this instance andNis the returned matrix. Note that normals transformed with the returned matrix may be scaled during transformation and require normalization.- Returns:
- a transform suitable for transforming normals
- Throws:
java.lang.IllegalStateException- if the matrix cannot be inverted- See Also:
- Transforming normals
-
preservesOrientation
public boolean preservesOrientation()
Return true if the transform preserves the orientation of the space. For example, in Euclidean 2D space, this will be true for translations, rotations, and scalings but will be false for reflections.This method returns true if the determinant of the matrix is positive.
- Specified by:
preservesOrientationin interfaceTransform<V extends EuclideanVector<V>>- Returns:
- true if the transform preserves the orientation of the space
- See Also:
- Orientation
-
-