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:
Function<V,
,V> 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 Object
implements EuclideanTransform<V>
Base class for affine transform matrices in Euclidean space.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract V
applyDirection
(V vec) Apply this transform to the given vector, ignoring translations and normalizing the result.abstract double
Get the determinant of the matrix.abstract M
inverse()
Get an instance representing the inverse transform.abstract M
linear()
Return a matrix containing only the linear portion of this transform.abstract M
Return a matrix containing the transpose of the linear portion of this transform.Return a transform suitable for transforming normals.boolean
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
-
Constructor Details
-
AbstractAffineTransformMatrix
public AbstractAffineTransformMatrix()
-
-
Method Details
-
applyDirection
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:
IllegalArgumentException
- if the transformed vector coordinates cannot be normalized- See Also:
-
determinant
public abstract double determinant()Get the determinant of the matrix.- Returns:
- the determinant of the matrix
-
inverse
Get an instance representing the inverse transform.- Specified by:
inverse
in interfaceTransform<V extends EuclideanVector<V>>
- Returns:
- an instance representing the inverse transform
- Throws:
IllegalStateException
- if the matrix cannot be inverted
-
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
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
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
, whereL
is the linear portion of this instance andN
is 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:
IllegalStateException
- if the matrix cannot be inverted- See Also:
-
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:
preservesOrientation
in interfaceTransform<V extends EuclideanVector<V>>
- Returns:
- true if the transform preserves the orientation of the space
- See Also:
-