public abstract class YawPitchRollConversion
extends java.lang.Object
WARNING: the Euler angles or yaw-pitch-roll representation is sensitive to gimbal lock and is sometimes undefined. Prefer using other representations of 3D orientation such as axis-angle, quaternion, or rotation matrix.
To convert an orientation into other data structure types see:
AxisAngleConversion
,
QuaternionConversion
,
RotationMatrixConversion
,
RotationVectorConversion
.
Note: the yaw-pitch-roll representation, also called Euler angles, corresponds to the representation of an orientation by decomposing it by three successive rotations around the three axes: Z (yaw), Y (pitch), and X (roll). The equivalent rotation matrix of such representation is:
R = RZ(yaw) * RY(pitch) * RX(roll) / cos(yaw) -sin(yaw) 0 \ RZ(yaw) = | sin(yaw) cos(yaw) 0 | \ 0 0 1 / / cos(pitch) 0 sin(pitch) \ RY(pitch) = | 0 1 0 | \ -sin(pitch) 0 cos(pitch) / / 1 0 0 \ RX(roll) = | 0 cos(roll) -sin(roll) | \ 0 sin(roll) cos(roll) /
Modifier and Type | Field and Description |
---|---|
static double |
MAX_SAFE_PITCH_ANGLE
Pitch angle that defines the upper bound of the safe region in which the resulting pitch angle
of a conversion is accurate.
|
static double |
MIN_SAFE_PITCH_ANGLE
Pitch angle that defines the lower bound of the safe region in which the resulting pitch angle
of a conversion is accurate.
|
static double |
SAFE_THRESHOLD_PITCH
Represents the safety margin that
|
Constructor and Description |
---|
YawPitchRollConversion() |
Modifier and Type | Method and Description |
---|---|
static double |
computePitch(AxisAngleReadOnly axisAngle)
Computes the pitch from an axis-angle.
|
static double |
computePitch(QuaternionReadOnly quaternion)
Computes the pitch from a quaternion.
|
static double |
computePitch(RotationMatrixReadOnly rotationMatrix)
Computes the pitch angle from a rotation matrix.
|
static double |
computePitch(RotationScaleMatrixReadOnly rotationScaleMatrix)
Computes the pitch angle from the rotation part of a rotation-scale matrix.
|
static double |
computePitch(Vector3DReadOnly rotationVector)
Computes the pitch from a rotation vector.
|
static double |
computeRoll(AxisAngleReadOnly axisAngle)
Computes the roll from an axis-angle.
|
static double |
computeRoll(QuaternionReadOnly quaternion)
Computes the roll from a quaternion.
|
static double |
computeRoll(RotationMatrixReadOnly rotationMatrix)
Computes the roll from a rotation matrix.
|
static double |
computeRoll(RotationScaleMatrixReadOnly rotationScaleMatrix)
Computes the roll from the rotation part of a rotation-scale matrix.
|
static double |
computeRoll(Vector3DReadOnly rotationVector)
Computes the roll from a rotation vector.
|
static double |
computeYaw(AxisAngleReadOnly axisAngle)
Computes the yaw from an axis-angle.
|
static double |
computeYaw(QuaternionReadOnly quaternion)
Computes the yaw from a quaternion.
|
static double |
computeYaw(RotationMatrixReadOnly rotationMatrix)
Computes the yaw from a rotation matrix.
|
static double |
computeYaw(RotationScaleMatrixReadOnly rotationScaleMatrix)
Computes the yaw from the rotation part of a rotation-scale matrix.
|
static double |
computeYaw(Vector3DReadOnly rotationVector)
Computes the yaw from a rotation vector.
|
static void |
convertAxisAngleToYawPitchRoll(AxisAngleReadOnly axisAngle,
double[] yawPitchRollToPack)
Converts the axis-angle into yaw-pitch-roll.
|
static void |
convertAxisAngleToYawPitchRoll(AxisAngleReadOnly axisAngle,
Tuple3DBasics eulerAnglesToPack)
Converts the axis-angle into yaw-pitch-roll.
|
static void |
convertMatrixToYawPitchRoll(RotationMatrixReadOnly rotationMatrix,
double[] yawPitchRollToPack)
Converts the rotation matrix into yaw-pitch-roll.
|
static void |
convertMatrixToYawPitchRoll(RotationMatrixReadOnly rotationMatrix,
Tuple3DBasics eulerAnglesToPack)
Converts the given rotation matrix into yaw-pitch-roll.
|
static void |
convertMatrixToYawPitchRoll(RotationScaleMatrixReadOnly rotationScaleMatrix,
double[] yawPitchRollToPack)
Converts the rotation part of the given rotation-scale matrix into yaw-pitch-roll.
|
static void |
convertMatrixToYawPitchRoll(RotationScaleMatrixReadOnly rotationScaleMatrix,
Tuple3DBasics eulerAnglesToPack)
Converts the rotation part of the given rotation-scale matrix into yaw-pitch-roll.
|
static void |
convertQuaternionToYawPitchRoll(QuaternionReadOnly quaternion,
double[] yawPitchRollToPack)
Converts the quaternion into yaw-pitch-roll.
|
static void |
convertQuaternionToYawPitchRoll(QuaternionReadOnly quaternion,
Tuple3DBasics eulerAnglesToPack)
Converts the given quaternion into yaw-pitch-roll.
|
static void |
convertRotationVectorToYawPitchRoll(Vector3DReadOnly rotationVector,
double[] yawPitchRollToPack)
Converts the rotation vector into yaw-pitch-roll.
|
static void |
convertRotationVectorToYawPitchRoll(Vector3DReadOnly rotationVector,
Vector3DBasics eulerAnglesToPack)
Converts the rotation vector into yaw-pitch-roll.
|
public static final double SAFE_THRESHOLD_PITCH
public static final double MAX_SAFE_PITCH_ANGLE
public static final double MIN_SAFE_PITCH_ANGLE
public static double computeYaw(RotationMatrixReadOnly rotationMatrix)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationMatrix
- the rotation matrix to use for the conversion. Not modified.public static double computePitch(RotationMatrixReadOnly rotationMatrix)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationMatrix
- the rotation matrix to use for the conversion. Not modified.public static double computeRoll(RotationMatrixReadOnly rotationMatrix)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationMatrix
- the rotation matrix to use for the conversion. Not modified.public static double computeYaw(RotationScaleMatrixReadOnly rotationScaleMatrix)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationScaleMatrix
- a 3-by-3 matrix representing an orientation and a scale. Only the
orientation part is used during the conversion. Not modified.public static double computePitch(RotationScaleMatrixReadOnly rotationScaleMatrix)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationScaleMatrix
- a 3-by-3 matrix representing an orientation and a scale. Only the
orientation part is used during the conversion. Not modified.public static double computeRoll(RotationScaleMatrixReadOnly rotationScaleMatrix)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationScaleMatrix
- a 3-by-3 matrix representing an orientation and a scale. Only the
orientation part is used during the conversion. Not modified.public static void convertMatrixToYawPitchRoll(RotationScaleMatrixReadOnly rotationScaleMatrix, double[] yawPitchRollToPack)
After calling this method, the rotation part of the rotation-scale matrix and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles
are set to Double.NaN
.
rotationScaleMatrix
- a 3-by-3 matrix representing an orientation and a scale. Only the
orientation part is used during the conversion. Not modified.yawPitchRollToPack
- the array in which the yaw-pitch-roll angles are stored, in the
order yaw
, pitch
, then roll
. Modified.public static void convertMatrixToYawPitchRoll(RotationMatrixReadOnly rotationMatrix, double[] yawPitchRollToPack)
After calling this method, the rotation matrix and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles
are set to Double.NaN
.
rotationMatrix
- a 3-by-3 matrix representing an orientation. Not modified.yawPitchRollToPack
- the array in which the yaw-pitch-roll angles are stored, in the
order yaw
, pitch
, then roll
. Modified.public static void convertMatrixToYawPitchRoll(RotationScaleMatrixReadOnly rotationScaleMatrix, Tuple3DBasics eulerAnglesToPack)
After calling this method, the rotation part of the rotation-scale matrix and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles
are set to Double.NaN
.
rotationScaleMatrix
- a 3-by-3 matrix representing an orientation and a scale. Only the
orientation part is used during the conversion. Not modified.eulerAnglesToPack
- the tuple in which the yaw-pitch-roll angles are stored, i.e.
eulerAnglesToPack.set(roll, pitch, yaw)
. Modified.public static void convertMatrixToYawPitchRoll(RotationMatrixReadOnly rotationMatrix, Tuple3DBasics eulerAnglesToPack)
After calling this method, the rotation matrix and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles
are set to Double.NaN
.
rotationMatrix
- a 3-by-3 matrix representing an orientation. Not modified.eulerAnglesToPack
- the tuple in which the yaw-pitch-roll angles are stored, i.e.
eulerAnglesToPack.set(roll, pitch, yaw)
. Modified.public static double computeYaw(QuaternionReadOnly quaternion)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
quaternion
- the quaternion to use in the conversion. Not modified.public static double computePitch(QuaternionReadOnly quaternion)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
quaternion
- the quaternion to use in the conversion. Not modified.public static double computeRoll(QuaternionReadOnly quaternion)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
quaternion
- the quaternion to use in the conversion. Not modified.public static void convertQuaternionToYawPitchRoll(QuaternionReadOnly quaternion, double[] yawPitchRollToPack)
After calling this method, the quaternion and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles are
set to Double.NaN
.
quaternion
- the quaternion to use in the conversion. Not modified.yawPitchRollToPack
- the array in which the yaw-pitch-roll angles are stored, in the
order yaw
, pitch
, then roll
. Modified.public static void convertQuaternionToYawPitchRoll(QuaternionReadOnly quaternion, Tuple3DBasics eulerAnglesToPack)
After calling this method, the quaternion and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles are
set to Double.NaN
.
quaternion
- the quaternion to use in the conversion. Not modified.eulerAnglesToPack
- the tuple in which the yaw-pitch-roll angles are stored, i.e.
eulerAnglesToPack.set(roll, pitch, yaw)
. Modified.public static double computeYaw(AxisAngleReadOnly axisAngle)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
axisAngle
- the axis-angle to use in the conversion. Not modified.public static double computePitch(AxisAngleReadOnly axisAngle)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
axisAngle
- the axis-angle to use in the conversion. Not modified.public static double computeRoll(AxisAngleReadOnly axisAngle)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
axisAngle
- the axis-angle to use in the conversion. Not modified.public static void convertAxisAngleToYawPitchRoll(AxisAngleReadOnly axisAngle, double[] yawPitchRollToPack)
After calling this method, the axis-angle and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles are
set to Double.NaN
.
axisAngle
- the axis-angle to use in the conversion. Not modified.yawPitchRollToPack
- the array in which the yaw-pitch-roll angles are stored, in the
order yaw
, pitch
, then roll
. Modified.public static void convertAxisAngleToYawPitchRoll(AxisAngleReadOnly axisAngle, Tuple3DBasics eulerAnglesToPack)
After calling this method, the axis-angle and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles are
set to Double.NaN
.
axisAngle
- the axis-angle to use in the conversion. Not modified.eulerAnglesToPack
- the tuple in which the yaw-pitch-roll angles are stored, i.e.
eulerAnglesToPack.set(roll, pitch, yaw)
. Modified.public static double computeYaw(Vector3DReadOnly rotationVector)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationVector
- the rotation vector to use in the conversion. Not modified.public static double computePitch(Vector3DReadOnly rotationVector)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationVector
- the rotation vector to use in the conversion. Not modified.public static double computeRoll(Vector3DReadOnly rotationVector)
Edge case:
Double.NaN
, this method returns
Double.NaN
.
rotationVector
- the rotation vector to use in the conversion. Not modified.public static void convertRotationVectorToYawPitchRoll(Vector3DReadOnly rotationVector, double[] yawPitchRollToPack)
After calling this method, the rotation vector and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles
are set to Double.NaN
.
rotationVector
- the rotation vector to use in the conversion. Not modified.yawPitchRollToPack
- the array in which the yaw-pitch-roll angles are stored, in the
order yaw
, pitch
, then roll
. Modified.public static void convertRotationVectorToYawPitchRoll(Vector3DReadOnly rotationVector, Vector3DBasics eulerAnglesToPack)
After calling this method, the rotation vector and the yaw-pitch-roll angles represent the same orientation.
Edge case:
Double.NaN
, the yaw-pitch-roll angles
are set to Double.NaN
.
rotationVector
- the rotation vector to use in the conversion. Not modified.eulerAnglesToPack
- the tuple in which the yaw-pitch-roll angles are stored, i.e.
eulerAnglesToPack.set(roll, pitch, yaw)
. Modified.