public final class AngleAxisRotation extends Object implements IEquatable<AngleAxisRotation>, IEquatableEpsilon<AngleAxisRotation>, ImmutableValueType
ElementaryRotation
,
EulerSequence
,
Matrix3By3
,
Quaternion
,
UnitQuaternion
,
YawPitchRoll
Constructor and Description |
---|
AngleAxisRotation()
Initializes a new instance.
|
AngleAxisRotation(double[] elements)
Initializes a set of
AngleAxisRotation coordinates from the first 4 consecutive elements in the provided array. |
AngleAxisRotation(double[] elements,
int startIndex)
Initializes a set of
AngleAxisRotation coordinates from the provided array. |
AngleAxisRotation(double angle,
UnitCartesian axis)
Initializes a set of
AngleAxisRotation coordinates from the provided values. |
AngleAxisRotation(ElementaryRotation rotation)
Initializes a set of
AngleAxisRotation coordinates from the provided ElementaryRotation . |
AngleAxisRotation(EulerSequence sequence)
Initializes a set of
AngleAxisRotation coordinates from the provided EulerSequence . |
AngleAxisRotation(Matrix3By3 matrix)
Initializes a set of
AngleAxisRotation coordinates from the provided Matrix3By3 . |
AngleAxisRotation(UnitQuaternion quaternion)
Initializes a set of
AngleAxisRotation coordinates from the provided UnitQuaternion . |
AngleAxisRotation(YawPitchRoll sequence)
Initializes a set of
AngleAxisRotation coordinates from the provided YawPitchRoll . |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(AngleAxisRotation left,
AngleAxisRotation right)
Returns
true if the two instances are exactly equal. |
boolean |
equals(Object obj)
Indicates whether another object is exactly equal to this instance.
|
boolean |
equalsEpsilon(AngleAxisRotation other,
double epsilon)
Returns true if all of the elements of this rotation are within
epsilon
of the same elements of the specified rotation. |
boolean |
equalsType(AngleAxisRotation other)
Indicates whether another instance of this type is exactly equal to this instance.
|
double |
get(int index)
Gets the value of the specified element with 0, 1, 2, and 3 corresponding to the elements Angle, Axis.X, Axis.Y, and Axis.Z.
|
double |
getAngle()
Gets the angle coordinate.
|
UnitCartesian |
getAxis()
Gets the unit vector representation the axis of rotation.
|
int |
getLength()
Gets the number of elements.
|
static AngleAxisRotation |
getZero()
Gets the set of
AngleAxisRotation coordinates representing the zero vector. |
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
AngleAxisRotation |
invert()
Returns the inverse of this angle-axis rotation.
|
static AngleAxisRotation |
multiply(AngleAxisRotation rotation,
double scalar)
Multiplies a specified
AngleAxisRotation by a scalar, yielding a new AngleAxisRotation . |
AngleAxisRotation |
multiply(double scalar)
Multiplies this instance by a scalar, yielding a new
AngleAxisRotation . |
static AngleAxisRotation |
multiply(double scalar,
AngleAxisRotation rotation)
Multiplies a scalar by a specified
AngleAxisRotation , yielding a new AngleAxisRotation . |
static boolean |
notEquals(AngleAxisRotation left,
AngleAxisRotation right)
Returns
true if the two instances are not exactly equal. |
String |
toString()
Returns the value of this set of
AngleAxisRotation coordinates in the form "angle, axis" |
public AngleAxisRotation()
public AngleAxisRotation(double angle, @Nonnull UnitCartesian axis)
AngleAxisRotation
coordinates from the provided values.angle
- The angle of rotation.axis
- The unit Cartesian vector representation the axis of rotation.public AngleAxisRotation(@Nonnull EulerSequence sequence)
AngleAxisRotation
coordinates from the provided EulerSequence
.sequence
- The Euler sequence of rotations.public AngleAxisRotation(@Nonnull YawPitchRoll sequence)
AngleAxisRotation
coordinates from the provided YawPitchRoll
.sequence
- The yaw-pitch-roll sequence of rotations.public AngleAxisRotation(@Nonnull ElementaryRotation rotation)
AngleAxisRotation
coordinates from the provided ElementaryRotation
.rotation
- The elementary rotation.UnsupportedCaseException
- Thrown if rotation
's Axis
(get
) property is not an AxisIndicator.FIRST
,
AxisIndicator.SECOND
, or AxisIndicator.THIRD
.public AngleAxisRotation(@Nonnull UnitQuaternion quaternion)
AngleAxisRotation
coordinates from the provided UnitQuaternion
.
If quaternion
is Identity
(get
), the resulting instance will be a 0.0
rotation around the X-axis.
quaternion
- The quaternion.public AngleAxisRotation(@Nonnull Matrix3By3 matrix)
AngleAxisRotation
coordinates from the provided Matrix3By3
.matrix
- The 3-by-3 rotation matrix.public AngleAxisRotation(@Nonnull double[] elements)
AngleAxisRotation
coordinates from the first 4 consecutive elements in the provided array.elements
- The array of element values.ArgumentNullException
- Thrown when elements
is null
.ArgumentOutOfRangeException
- Thrown when an object of this type is constructed from an array with less than 4 elements
.public AngleAxisRotation(@Nonnull double[] elements, int startIndex)
AngleAxisRotation
coordinates from the provided array.elements
- The array of element values.startIndex
- The index of the first element in the array to use.ArgumentNullException
- Thrown when elements
is null
.ArgumentOutOfRangeException
- Thrown when an object of this type is constructed from an array with less than 4 elements
.@Nonnull public static AngleAxisRotation getZero()
AngleAxisRotation
coordinates representing the zero vector.AngleAxisRotation
coordinates representing the zero vector.public final double getAngle()
@Nonnull public final UnitCartesian getAxis()
@Nonnull public final AngleAxisRotation invert()
@Nonnull public final AngleAxisRotation multiply(double scalar)
AngleAxisRotation
.scalar
- The scalar.@Nonnull public static AngleAxisRotation multiply(@Nonnull AngleAxisRotation rotation, double scalar)
AngleAxisRotation
by a scalar, yielding a new AngleAxisRotation
.rotation
- The rotation.scalar
- The scalar.@Nonnull public static AngleAxisRotation multiply(double scalar, @Nonnull AngleAxisRotation rotation)
AngleAxisRotation
, yielding a new AngleAxisRotation
.scalar
- The scalar.rotation
- The rotation.public final int getLength()
public final double get(int index)
index
- The index.ArgumentOutOfRangeException
- Thrown when index
is less than 0 or greater than or equal to Length
(get
).public boolean equals(Object obj)
equals
in class Object
obj
- The object to compare to this instance.true
if obj
is an instance of this type and represents the same value as this instance; otherwise false
.Object.hashCode()
,
HashMap
public final boolean equalsType(@Nonnull AngleAxisRotation other)
equalsType
in interface IEquatable<AngleAxisRotation>
other
- The instance to compare to this instance.true
if other
represents the same value as this instance; otherwise false
.public final boolean equalsEpsilon(@Nonnull AngleAxisRotation other, double epsilon)
epsilon
of the same elements of the specified rotation. That is, in order for two items to be
considered equal (and for this function to return true), the absolute value of the
difference between each of their elements must be less than or equal to epsilon
.equalsEpsilon
in interface IEquatableEpsilon<AngleAxisRotation>
other
- The rotation to compare to this rotation.epsilon
- The largest difference between the elements of the rotations for which they will be considered equal.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
AngleAxisRotation
coordinates in the form "angle, axis"public static boolean equals(@Nonnull AngleAxisRotation left, @Nonnull AngleAxisRotation right)
true
if the two instances are exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
represents the same value as right
; otherwise false
.public static boolean notEquals(@Nonnull AngleAxisRotation left, @Nonnull AngleAxisRotation right)
true
if the two instances are not exactly equal.left
- The instance to compare to right
.right
- The instance to compare to left
.true
if left
does not represent the same value as right
; otherwise false
.