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 | 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 | Description |
---|---|
YawPitchRollConversion() |
Modifier and Type | Method | Description |
---|---|---|
static double |
computePitch(AxisAngleReadOnly axisAngle) |
Computes the pitch from an axis-angle.
|
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 |
computePitch(QuaternionReadOnly quaternion) |
Computes the pitch from a quaternion.
|
(package private) static double |
computePitchFromAxisAngleImpl(double ux,
double uy,
double uz,
double angle) |
Computes the pitch from the given axis-angle.
|
(package private) static double |
computePitchFromQuaternionImpl(double qx,
double qy,
double qz,
double qs) |
Computes the pitch from a quaternion.
|
(package private) static double |
computePitchImpl(double m20) |
Computes the pitch from a rotation matrix.
|
static double |
computeRoll(AxisAngleReadOnly axisAngle) |
Computes the roll from an axis-angle.
|
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 |
computeRoll(QuaternionReadOnly quaternion) |
Computes the roll from a quaternion.
|
(package private) static double |
computeRollFromAxisAngleImpl(double ux,
double uy,
double uz,
double angle) |
Computes the roll from the given axis-angle.
|
(package private) static double |
computeRollFromQuaternionImpl(double qx,
double qy,
double qz,
double qs) |
Computes the roll from a quaternion.
|
(package private) static double |
computeRollImpl(double m21,
double m22) |
Computes the roll from a rotation matrix.
|
static double |
computeYaw(AxisAngleReadOnly axisAngle) |
Computes the yaw from an axis-angle.
|
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 double |
computeYaw(QuaternionReadOnly quaternion) |
Computes the yaw from a quaternion.
|
(package private) static double |
computeYawFromAxisAngleImpl(double ux,
double uy,
double uz,
double angle) |
Computes the yaw from the given axis-angle.
|
(package private) static double |
computeYawFromQuaternionImpl(double qx,
double qy,
double qz,
double qs) |
Computes the yaw from a quaternion.
|
(package private) static double |
computeYawImpl(double m00,
double m10) |
Computes the yaw from a rotation matrix.
|
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.
|
(package private) static void |
convertAxisAngleToYawPitchRollImpl(double ux,
double uy,
double uz,
double angle,
double[] yawPitchRollToPack) |
Converts the axis-angle into yaw-pitch-roll.
|
(package private) static void |
convertAxisAngleToYawPitchRollImpl(double ux,
double uy,
double uz,
double angle,
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
static double computeYawImpl(double m00, double m10)
This method is for internal use. Use computeYaw(RotationMatrixReadOnly)
instead.
Edge case:
Double.NaN
, this method returns
Double.NaN
.
m00
- the new 1st row 1st column coefficient for the matrix to use for the conversion.m10
- the new 2nd row 1st column coefficient for the matrix to use for the conversion.static double computePitchImpl(double m20)
This method is for internal use. Use computePitch(RotationMatrixReadOnly)
instead.
Edge case:
Double.NaN
, this method returns
Double.NaN
.
m20
- the new 3rd row 1st column coefficient for the matrix to use for the conversion.static double computeRollImpl(double m21, double m22)
This method is for internal use. Use computeRoll(RotationMatrixReadOnly)
instead.
Edge case:
Double.NaN
, this method returns
Double.NaN
.
m21
- the new 3rd row 2nd column coefficient for the matrix to use for the conversion.m22
- the new 3rd row 3rd column coefficient for the matrix to use for the conversion.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.static double computeYawFromQuaternionImpl(double qx, double qy, double qz, double qs)
This method is for internal use. Use computeYaw(QuaternionReadOnly)
instead.
qx
- the x-component of the quaternion to use in the conversion.qy
- the y-component of the quaternion to use in the conversion.qz
- the z-component of the quaternion to use in the conversion.qs
- the s-component of the quaternion to use in the conversion.static double computePitchFromQuaternionImpl(double qx, double qy, double qz, double qs)
This method is for internal use. Use computePitch(QuaternionReadOnly)
instead.
qx
- the x-component of the quaternion to use in the conversion.qy
- the y-component of the quaternion to use in the conversion.qz
- the z-component of the quaternion to use in the conversion.qs
- the s-component of the quaternion to use in the conversion.static double computeRollFromQuaternionImpl(double qx, double qy, double qz, double qs)
This method is for internal use. Use computeRoll(QuaternionReadOnly)
instead.
qx
- the x-component of the quaternion to use in the conversion.qy
- the y-component of the quaternion to use in the conversion.qz
- the z-component of the quaternion to use in the conversion.qs
- the s-component of the quaternion to use in the conversion.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.static double computeYawFromAxisAngleImpl(double ux, double uy, double uz, double angle)
This method is for internal use. Use computeYaw(AxisAngleReadOnly)
instead.
ux
- the x-component of the axis of the axis-angle to use in the conversion.uy
- the y-component of the axis of the axis-angle to use in the conversion.uz
- the z-component of the axis of the axis-angle to use in the conversion.angle
- the angle of the axis-angle to use in the conversion.static double computePitchFromAxisAngleImpl(double ux, double uy, double uz, double angle)
This method is for internal use. Use computePitch(AxisAngleReadOnly)
instead.
ux
- the x-component of the axis of the axis-angle to use in the conversion.uy
- the y-component of the axis of the axis-angle to use in the conversion.uz
- the z-component of the axis of the axis-angle to use in the conversion.angle
- the angle of the axis-angle to use in the conversion.static double computeRollFromAxisAngleImpl(double ux, double uy, double uz, double angle)
This method is for internal use. Use computeRoll(AxisAngleReadOnly)
instead.
ux
- the x-component of the axis of the axis-angle to use in the conversion.uy
- the y-component of the axis of the axis-angle to use in the conversion.uz
- the z-component of the axis of the axis-angle to use in the conversion.angle
- the angle of the axis-angle to use in the conversion.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.static void convertAxisAngleToYawPitchRollImpl(double ux, double uy, double uz, double angle, double[] yawPitchRollToPack)
This method is for internal use. Use computeYaw(AxisAngleReadOnly)
instead.
After calling this method, the axis-angle and the yaw-pitch-roll angles represent the same orientation.
ux
- the x-component of the axis of the axis-angle to use in the conversion.uy
- the y-component of the axis of the axis-angle to use in the conversion.uz
- the z-component of the axis of the axis-angle to use in the conversion.angle
- the angle of the axis-angle to use in the conversion.yawPitchRollToPack
- the array in which the yaw-pitch-roll angles are stored, in the
order yaw
, pitch
, then roll
. Modified.static void convertAxisAngleToYawPitchRollImpl(double ux, double uy, double uz, double angle, Tuple3DBasics eulerAnglesToPack)
This method is for internal use. Use computeYaw(AxisAngleReadOnly)
instead.
After calling this method, the axis-angle and the yaw-pitch-roll angles represent the same orientation.
ux
- the x-component of the axis of the axis-angle to use in the conversion.uy
- the y-component of the axis of the axis-angle to use in the conversion.uz
- the z-component of the axis of the axis-angle to use in the conversion.angle
- the angle of the axis-angle to use in the conversion.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.