Class Transform2S
java.lang.Object
org.apache.commons.geometry.spherical.twod.Transform2S
Implementation of the
Transform
interface for spherical 2D points.
This class uses an AffineTransformMatrix3D
to perform spherical point transforms
in Euclidean 3D space.
Instances of this class are guaranteed to be immutable.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AffineTransformMatrix3D
Euclidean transform matrix underlying the spherical transform.private static final Transform2S
Static instance representing the identity transform.private static final AffineTransformMatrix3D
Static transform instance that reflects across the x-y plane. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Transform2S
(AffineTransformMatrix3D euclideanTransform) Construct a new instance from its underlying Euclidean transform. -
Method Summary
Modifier and TypeMethodDescriptionstatic Transform2S
createReflection
(Vector3D poleVector) Create a transform that performs a reflection across the equatorial plane defined by the given pole point.static Transform2S
createReflection
(Point2S pole) Create a transform that performs a reflection across the equatorial plane defined by the given pole point.static Transform2S
createRotation
(QuaternionRotation quaternion) Create a transform that performs the given 3D rotation.static Transform2S
createRotation
(Vector3D axis, double angle) Create a transform that rotates the given angle aroundaxis
.static Transform2S
createRotation
(Point2S pt, double angle) Create a transform that rotates the given angle aroundpt
.boolean
Return true if the given object is an instance ofTransform2S
and the underlying Euclidean transform matrices are exactly equal.Get the Euclidean transform matrix underlying the spherical transform.int
hashCode()
static Transform2S
identity()
Return an instance representing the identity transform.inverse()
Get an instance representing the inverse transform.multiply
(Transform2S other) Multiply the underlying Euclidean transform of this instance by that of the argument, eg,other * this
.private static Transform2S
multiply
(Transform2S a, Transform2S b) Multiply the Euclidean transform matrices of the arguments together.premultiply
(Transform2S other) Multiply the underlying Euclidean transform matrix of the argument by that of this instance, eg,this * other
.boolean
Return true if the transform preserves the orientation of the space.Apply a reflection across the equatorial plane defined by the given pole vector to this instance.Apply a reflection across the equatorial plane defined by the given pole point to this instance.rotate
(QuaternionRotation quaternion) Apply the given quaternion rotation to this instance.Apply a rotation ofangle
radians around the given 3D axis to this instance.Apply a rotation ofangle
radians around the given point to this instance.toString()
-
Field Details
-
IDENTITY
Static instance representing the identity transform. -
XY_PLANE_REFLECTION
Static transform instance that reflects across the x-y plane. -
euclideanTransform
Euclidean transform matrix underlying the spherical transform.
-
-
Constructor Details
-
Transform2S
Construct a new instance from its underlying Euclidean transform.- Parameters:
euclideanTransform
- underlying Euclidean transform
-
-
Method Details
-
getEuclideanTransform
Get the Euclidean transform matrix underlying the spherical transform.- Returns:
- the Euclidean transform matrix underlying the spherical transform
-
apply
-
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.- Specified by:
preservesOrientation
in interfaceTransform<Point2S>
- Returns:
- true if the transform preserves the orientation of the space
- See Also:
-
inverse
Get an instance representing the inverse transform. -
rotate
Apply a rotation ofangle
radians around the given point to this instance.- Parameters:
pt
- point to rotate aroundangle
- rotation angle in radians- Returns:
- transform resulting from applying the specified rotation to this instance
-
rotate
Apply a rotation ofangle
radians around the given 3D axis to this instance.- Parameters:
axis
- 3D axis of rotationangle
- rotation angle in radians- Returns:
- transform resulting from applying the specified rotation to this instance
-
rotate
Apply the given quaternion rotation to this instance.- Parameters:
quaternion
- quaternion rotation to apply- Returns:
- transform resulting from applying the specified rotation to this instance
-
reflect
Apply a reflection across the equatorial plane defined by the given pole point to this instance.- Parameters:
pole
- pole point defining the equatorial reflection plane- Returns:
- transform resulting from applying the specified reflection to this instance
-
reflect
Apply a reflection across the equatorial plane defined by the given pole vector to this instance.- Parameters:
poleVector
- pole vector defining the equatorial reflection plane- Returns:
- transform resulting from applying the specified reflection to this instance
-
multiply
Multiply the underlying Euclidean transform of this instance by that of the argument, eg,other * this
. The returned transform performs the equivalent ofother
followed bythis
.- Parameters:
other
- transform to multiply with- Returns:
- a new transform computed by multiplying the matrix of this instance by that of the argument
- See Also:
-
premultiply
Multiply the underlying Euclidean transform matrix of the argument by that of this instance, eg,this * other
. The returned transform performs the equivalent ofthis
followed byother
.- Parameters:
other
- transform to multiply with- Returns:
- a new transform computed by multiplying the matrix of the argument by that of this instance
- See Also:
-
hashCode
public int hashCode() -
equals
Return true if the given object is an instance ofTransform2S
and the underlying Euclidean transform matrices are exactly equal. -
toString
-
identity
Return an instance representing the identity transform. This transform is guaranteed to return an equivalent (ie, co-located) point for any input point. However, the points are not guaranteed to contain exactly equal coordinates. For example, at the poles, an infinite number of points exist that vary only in the azimuth coordinate. When one of these points is transformed by this identity transform, the returned point may contain a different azimuth value from the input, but it will still represent the same location in space.- Returns:
- an instance representing the identity transform
-
createRotation
Create a transform that rotates the given angle aroundpt
.- Parameters:
pt
- point to rotate aroundangle
- angle of rotation in radians- Returns:
- a transform that rotates the given angle around
pt
-
createRotation
Create a transform that rotates the given angle aroundaxis
.- Parameters:
axis
- 3D axis of rotationangle
- angle of rotation in radians- Returns:
- a transform that rotates the given angle
axis
-
createRotation
Create a transform that performs the given 3D rotation.- Parameters:
quaternion
- quaternion instance representing the 3D rotation- Returns:
- a transform that performs the given 3D rotation
-
createReflection
Create a transform that performs a reflection across the equatorial plane defined by the given pole point.- Parameters:
pole
- pole point defining the equatorial reflection plane- Returns:
- a transform that performs a reflection across the equatorial plane defined by the given pole point
-
createReflection
Create a transform that performs a reflection across the equatorial plane defined by the given pole point.- Parameters:
poleVector
- pole vector defining the equatorial reflection plane- Returns:
- a transform that performs a reflection across the equatorial plane defined by the given pole point
-
multiply
Multiply the Euclidean transform matrices of the arguments together.- Parameters:
a
- first transformb
- second transform- Returns:
- the transform computed as
a x b
-