public abstract class QuaternionConversion
extends java.lang.Object
To convert an orientation into other data structure types see:
AxisAngleConversion
,
RotationMatrixConversion
,
RotationVectorConversion
,
YawPitchRollConversion
.
Modifier and Type | Field | Description |
---|---|---|
static double |
EPS |
Tolerance used to identify various edge cases, such as to identify when an axis-angle represents
a zero orientation.
|
Constructor | Description |
---|---|
QuaternionConversion() |
Modifier and Type | Method | Description |
---|---|---|
static void |
computePitchQuaternion(double pitch,
QuaternionBasics quaternionToPack) |
Sets the given quaternion to represent a counter clockwise rotation around the y-axis of an angle
pitch . |
static void |
computeRollQuaternion(double roll,
QuaternionBasics quaternionToPack) |
Sets the given quaternion to represent a counter clockwise rotation around the x-axis of an angle
roll . |
static void |
computeYawQuaternion(double yaw,
QuaternionBasics quaternionToPack) |
Sets the given quaternion to represent a counter clockwise rotation around the z-axis of an angle
yaw . |
static void |
convertAxisAngleToQuaternion(double ux,
double uy,
double uz,
double angle,
QuaternionBasics quaternionToPack) |
Converts the given axis-angle into a quaternion.
|
static void |
convertAxisAngleToQuaternion(AxisAngleReadOnly axisAngle,
QuaternionBasics quaternionToPack) |
Converts the given axis-angle into a quaternion.
|
static void |
convertMatrixToQuaternion(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22,
QuaternionBasics quaternionToPack) |
Converts the given rotation matrix into a quaternion.
|
static void |
convertMatrixToQuaternion(RotationMatrixReadOnly rotationMatrix,
QuaternionBasics quaternionToPack) |
Converts the given rotation matrix into a quaternion.
|
static void |
convertMatrixToQuaternion(RotationScaleMatrixReadOnly rotationScaleMatrix,
QuaternionBasics quaternionToPack) |
Converts the given rotation part of the given rotation-scale matrix into a quaternion.
|
static void |
convertRotationVectorToQuaternion(double rx,
double ry,
double rz,
QuaternionBasics quaternionToPack) |
Converts the rotation vector into a quaternion.
|
static void |
convertRotationVectorToQuaternion(Vector3DReadOnly rotationVector,
QuaternionBasics quaternionToPack) |
Converts the rotation vector into a quaternion.
|
static void |
convertYawPitchRollToQuaternion(double[] yawPitchRoll,
QuaternionBasics quaternionToPack) |
Converts the given yaw-pitch-roll angles into a quaternion.
|
static void |
convertYawPitchRollToQuaternion(double yaw,
double pitch,
double roll,
QuaternionBasics quaternionToPack) |
Converts the given yaw-pitch-roll angles into a quaternion.
|
public static final double EPS
public static final void computeYawQuaternion(double yaw, QuaternionBasics quaternionToPack)
yaw
.yaw
- the angle to rotate about the z-axis.quaternionToPack
- the quaternion in which the result is stored.public static final void computePitchQuaternion(double pitch, QuaternionBasics quaternionToPack)
pitch
.pitch
- the angle to rotate about the y-axis.quaternionToPack
- the quaternion in which the result is stored.public static final void computeRollQuaternion(double roll, QuaternionBasics quaternionToPack)
roll
.roll
- the angle to rotate about the x-axis.quaternionToPack
- the quaternion in which the result is stored.public static final void convertAxisAngleToQuaternion(AxisAngleReadOnly axisAngle, QuaternionBasics quaternionToPack)
After calling this method, the axis-angle and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
EPS
, the rotation matrix is set to the neutral
quaternion.
axisAngle
- the axis-angle to use for the conversion. Not modified.quaternionToPack
- the quaternion in which the result is stored.public static final void convertAxisAngleToQuaternion(double ux, double uy, double uz, double angle, QuaternionBasics quaternionToPack)
After calling this method, the axis-angle and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
EPS
, the rotation matrix is set to the neutral
quaternion.
ux
- the axis x-component of the axis-angle to use for the conversion.uy
- the axis y-component of the axis-angle to use for the conversion.uz
- the axis z-component of the axis-angle to use for the conversion.angle
- the angle of the axis-angle to use for the conversion.quaternionToPack
- the quaternion in which the result is stored.public static void convertMatrixToQuaternion(RotationScaleMatrixReadOnly rotationScaleMatrix, QuaternionBasics quaternionToPack)
After calling this method, the rotation part of the rotation-scale matrix and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is 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.quaternionToPack
- the quaternion in which the result is stored.public static void convertMatrixToQuaternion(RotationMatrixReadOnly rotationMatrix, QuaternionBasics quaternionToPack)
After calling this method, the rotation matrix and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
rotationMatrix
- a 3-by-3 matrix representing an orientation. Not modified.quaternionToPack
- the quaternion in which the result is stored.public static void convertMatrixToQuaternion(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22, QuaternionBasics quaternionToPack)
After calling this method, the rotation matrix and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
m00
- the 1st row 1st column coefficient of the rotation matrix.m01
- the 1st row 2nd column coefficient of the rotation matrix.m02
- the 1st row 3rd column coefficient of the rotation matrix.m10
- the 2nd row 1st column coefficient of the rotation matrix.m11
- the 2nd row 2nd column coefficient of the rotation matrix.m12
- the 2nd row 3rd column coefficient of the rotation matrix.m20
- the 3rd row 1st column coefficient of the rotation matrix.m21
- the 3rd row 2nd column coefficient of the rotation matrix.m22
- the 3rd row 3rd column coefficient of the rotation matrix.quaternionToPack
- the quaternion in which the result is stored.public static void convertRotationVectorToQuaternion(Vector3DReadOnly rotationVector, QuaternionBasics quaternionToPack)
After calling this method, the rotation vector and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
WARNING: a rotation vector is different from a yaw-pitch-roll or Euler angles representation. A rotation vector is equivalent to the axis of an axis-angle that is multiplied by the angle of the same axis-angle.
rotationVector
- the rotation vector to use in the conversion. Not modified.quaternionToPack
- the quaternion in which the result is stored.public static void convertRotationVectorToQuaternion(double rx, double ry, double rz, QuaternionBasics quaternionToPack)
After calling this method, the rotation vector and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
WARNING: a rotation vector is different from a yaw-pitch-roll or Euler angles representation. A rotation vector is equivalent to the axis of an axis-angle that is multiplied by the angle of the same axis-angle.
rx
- the x-component of the rotation vector to use in the conversion.ry
- the y-component of the rotation vector to use in the conversion.rz
- the z-component of the rotation vector to use in the conversion.quaternionToPack
- the quaternion in which the result is stored.public static void convertYawPitchRollToQuaternion(double[] yawPitchRoll, QuaternionBasics quaternionToPack)
After calling this method, the yaw-pitch-roll and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
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)
yawPitchRoll
- the yaw-pitch-roll angles to use in the conversion. Not modified.quaternionToPack
- the quaternion in which the result is stored.public static void convertYawPitchRollToQuaternion(double yaw, double pitch, double roll, QuaternionBasics quaternionToPack)
After calling this method, the yaw-pitch-roll and the quaternion represent the same orientation.
Edge case:
Double.NaN
, the quaternion is set to
Double.NaN
.
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)
yaw
- the yaw angle to use in the conversion.pitch
- the pitch angle to use in the conversion.roll
- the roll angle to use in the conversion.quaternionToPack
- the quaternion in which the result is stored.