public final class EulerSequence extends Object implements IEquatable<EulerSequence>, IEquatableEpsilon<EulerSequence>, ImmutableValueType
Represents a rotation as a sequence of three ElementaryRotations
about consecutive axes. The first elementary rotation results in an intermediate orientation and associated set of axes
from which the second elementary rotation is performed. Likewise, the third elementary rotation is performed from the
intermediate orientation and set of axes which result from the second rotation.
A 321 Euler sequence is commonly used to represent yaw about the z-axis, followed by pitch about the resulting y-axis, and then roll about the resulting x-axis when expressing the attitude of a vehicle relative to some reference orientation.
A 321 Euler sequence can be used to express the yaw (heading), pitch (elevation), and roll (bank) orientation
of the vehicle body axis relative to the local North-East-Down
axes of the vehicle. To obtain these angles, use a 321 EulerSequence
as shown below:
Point myVehiclePoint = propagator.createPoint();
EarthCentralBody earth = CentralBodiesFacet.getFromContext().getEarth();
AxesNorthEastDown ned = new AxesNorthEastDown(earth, myVehiclePoint);
Vector surfaceNormal = new VectorEllipsoidSurfaceNormal(earth.getShape(), earth.getFixedFrame(), myVehiclePoint);
AxesAlignedConstrained vehicleBodyAxes = new AxesAlignedConstrained(
new VectorVelocity(myVehiclePoint, earth.getFixedFrame()), AxisIndicator.FIRST,
new VectorInverted(surfaceNormal), AxisIndicator.THIRD);
AxesEvaluator rotationEvaluator = GeometryTransformer.getAxesTransformation(ned, vehicleBodyAxes);
UnitQuaternion ned2body = rotationEvaluator.evaluate(propagator.getTimeInterval().getStart());
EulerSequence yawPitchRoll = new EulerSequence(ned2body, EulerSequenceIndicator.EULER321);
double yaw = yawPitchRoll.getFirstRotation().getAngle();
double pitch = yawPitchRoll.getSecondRotation().getAngle();
double roll = yawPitchRoll.getThirdRotation().getAngle();
Constructor and Description |
---|
EulerSequence()
Initializes a new instance.
|
EulerSequence(AngleAxisRotation rotation,
EulerSequenceIndicator sequence)
Initializes an
EulerSequence from the provided AngleAxisRotation and sequence. |
EulerSequence(double angle1,
double angle2,
double angle3,
EulerSequenceIndicator sequence)
Initializes an
EulerSequence from the provided angles and sequence. |
EulerSequence(ElementaryRotation firstRotation,
ElementaryRotation secondRotation,
ElementaryRotation thirdRotation)
Initializes an
EulerSequence from the provided
ElementaryRotations . |
EulerSequence(Matrix3By3 matrix,
EulerSequenceIndicator sequence)
Initializes an
EulerSequence from the provided Matrix3By3 and sequence. |
EulerSequence(UnitQuaternion quaternion,
EulerSequenceIndicator sequence)
Initializes an
EulerSequence from the provided UnitQuaternion and sequence. |
EulerSequence(YawPitchRoll sequence)
Initializes an
EulerSequence from the provided YawPitchRoll sequence. |
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(EulerSequence left,
EulerSequence 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(EulerSequence 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(EulerSequence other)
Indicates whether another instance of this type is exactly equal to this instance.
|
static AxisIndicator |
firstAxis(EulerSequenceIndicator sequence)
Determines the first axis indicator from the provided
EulerSequenceIndicator . |
ElementaryRotation |
getFirstRotation()
Gets the first rotation.
|
ElementaryRotation |
getSecondRotation()
Gets the second rotation.
|
EulerSequenceIndicator |
getSequence()
Gets the order of the axes rotations for this instance.
|
ElementaryRotation |
getThirdRotation()
Gets the third rotation.
|
int |
hashCode()
Returns a hash code for this instance, which is suitable for use in hashing algorithms and data structures like a hash table.
|
static EulerSequenceIndicator |
indicator(AxisIndicator first,
AxisIndicator second,
AxisIndicator third)
Composes a
EulerSequenceIndicator from three individual AxisIndicator items. |
EulerSequence |
invert()
Inverts this instance, yielding a new
EulerSequence . |
static boolean |
notEquals(EulerSequence left,
EulerSequence right)
Returns
true if the two instances are not exactly equal. |
static AxisIndicator |
secondAxis(EulerSequenceIndicator sequence)
Determines the second axis indicator from the provided
EulerSequenceIndicator . |
static AxisIndicator |
thirdAxis(EulerSequenceIndicator sequence)
Determines the third axis indicator from the provided
EulerSequenceIndicator . |
String |
toString()
Returns the value of this set of
EulerSequence coordinates in the form "first rotation, second rotation, third rotation" |
public EulerSequence()
public EulerSequence(double angle1, double angle2, double angle3, @Nonnull EulerSequenceIndicator sequence)
EulerSequence
from the provided angles and sequence.angle1
- The first angle.angle2
- The second angle.angle3
- The third angle.sequence
- The sequence.public EulerSequence(@Nonnull ElementaryRotation firstRotation, @Nonnull ElementaryRotation secondRotation, @Nonnull ElementaryRotation thirdRotation)
EulerSequence
from the provided
ElementaryRotations
.firstRotation
- The first rotation.secondRotation
- The second rotation.thirdRotation
- The third rotation.public EulerSequence(@Nonnull YawPitchRoll sequence)
EulerSequence
from the provided YawPitchRoll
sequence.sequence
- The sequence.public EulerSequence(@Nonnull Matrix3By3 matrix, @Nonnull EulerSequenceIndicator sequence)
EulerSequence
from the provided Matrix3By3
and sequence.
Note that the matrix
must be an orthogonal rotation matrix.
matrix
- The orthogonal rotation matrix.sequence
- The sequence.public EulerSequence(@Nonnull UnitQuaternion quaternion, @Nonnull EulerSequenceIndicator sequence)
EulerSequence
from the provided UnitQuaternion
and sequence.quaternion
- The unit quaternion.sequence
- The sequence.public EulerSequence(@Nonnull AngleAxisRotation rotation, @Nonnull EulerSequenceIndicator sequence)
EulerSequence
from the provided AngleAxisRotation
and sequence.rotation
- The rotation.sequence
- The sequence.@Nonnull public static EulerSequenceIndicator indicator(@Nonnull AxisIndicator first, @Nonnull AxisIndicator second, @Nonnull AxisIndicator third)
EulerSequenceIndicator
from three individual AxisIndicator
items.first
- The first axis of rotation.second
- The second axis of rotation.third
- The third axis of rotation.@Nonnull public static AxisIndicator firstAxis(@Nonnull EulerSequenceIndicator sequence)
EulerSequenceIndicator
.sequence
- The order of the axes of rotation.@Nonnull public static AxisIndicator secondAxis(@Nonnull EulerSequenceIndicator sequence)
EulerSequenceIndicator
.sequence
- The order of the axes of rotation.@Nonnull public static AxisIndicator thirdAxis(@Nonnull EulerSequenceIndicator sequence)
EulerSequenceIndicator
.sequence
- The order of the axes of rotation.@Nonnull public final ElementaryRotation getFirstRotation()
@Nonnull public final ElementaryRotation getSecondRotation()
@Nonnull public final ElementaryRotation getThirdRotation()
@Nonnull public final EulerSequenceIndicator getSequence()
@Nonnull public final EulerSequence invert()
EulerSequence
.EulerSequence
.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 EulerSequence other)
equalsType
in interface IEquatable<EulerSequence>
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 EulerSequence other, double epsilon)
true
if all of the elements of this rotation are within epsilon
of the same elements of the specified rotation. That is, in order for the rotations 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<EulerSequence>
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.true
if the rotations are equal as defined by the epsilon value.public int hashCode()
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public String toString()
EulerSequence
coordinates in the form "first rotation, second rotation, third rotation"public static boolean equals(@Nonnull EulerSequence left, @Nonnull EulerSequence 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 EulerSequence left, @Nonnull EulerSequence 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
.