public final class Rotation2D extends Object implements EuclideanTransform<Vector2D>
Modifier and Type | Method and Description |
---|---|
Vector2D |
apply(Vector2D pt) |
Vector2D |
applyVector(Vector2D vec)
Apply this transform to the given vector, ignoring translations.
|
static Rotation2D |
createVectorRotation(Vector2D u,
Vector2D v)
Create a rotation instance that rotates the vector
u to point in the direction of
vector v . |
boolean |
equals(Object obj) |
double |
getAngle()
Get the angle of rotation in radians.
|
int |
hashCode() |
static Rotation2D |
identity()
Return an instance representing the identity rotation, ie a rotation
of zero radians.
|
Rotation2D |
inverse() |
static Rotation2D |
of(double angle)
Create a new instance with the given angle of rotation.
|
boolean |
preservesOrientation() |
AffineTransformMatrix2D |
toMatrix()
Return an
AffineTransformMatrix2D representing the same rotation
as this instance. |
String |
toString() |
public double getAngle()
public Rotation2D inverse()
public boolean preservesOrientation()
This method simply returns true since rotations always preserve the orientation of the space.
preservesOrientation
in interface Transform<Vector2D>
public Vector2D applyVector(Vector2D vec)
This method can be used to transform vector instances representing displacements between points.
For example, if v
represents the difference between points p1
and p2
,
then transform.applyVector(v)
will represent the difference between p1
and p2
after transform
is applied.
This method simply calls apply(vec)
since rotations treat
points and vectors similarly.
applyVector
in interface EuclideanTransform<Vector2D>
vec
- the vector to transformpublic AffineTransformMatrix2D toMatrix()
AffineTransformMatrix2D
representing the same rotation
as this instance.public static Rotation2D of(double angle)
angle
- the angle of rotation in radianspublic static Rotation2D identity()
public static Rotation2D createVectorRotation(Vector2D u, Vector2D v)
u
to point in the direction of
vector v
.u
- input vectorv
- target vectoru
to point in the direction of v
IllegalArgumentException
- if either vector cannot be normalizedCopyright © 2016–2021 The Apache Software Foundation. All rights reserved.