public abstract class RotationMatrixConversion
extends java.lang.Object
To convert an orientation into other data structure types see:
QuaternionConversion
,
AxisAngleConversion
,
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 |
---|---|
RotationMatrixConversion() |
Modifier and Type | Method | Description |
---|---|---|
static void |
computePitchMatrix(double pitch,
RotationMatrix matrixToPack) |
Sets the given rotation matrix to represent a counter clockwise rotation around the y-axis of an
angle
pitch . |
static void |
computeRollMatrix(double roll,
RotationMatrix matrixToPack) |
Sets the given rotation matrix to represent a counter clockwise rotation around the x-axis of an
angle
roll . |
static void |
computeYawMatrix(double yaw,
RotationMatrix matrixToPack) |
Sets the given rotation matrix to represent a counter clockwise rotation around the z-axis of an
angle
yaw . |
static void |
convertAxisAngleToMatrix(double ux,
double uy,
double uz,
double angle,
RotationMatrix matrixToPack) |
Converts the given axis-angle into a rotation matrix.
|
static void |
convertAxisAngleToMatrix(AxisAngleReadOnly axisAngle,
RotationMatrix matrixToPack) |
Converts the given axis-angle into a rotation matrix.
|
static void |
convertQuaternionToMatrix(double qx,
double qy,
double qz,
double qs,
RotationMatrix matrixToPack) |
Converts the given quaternion into a rotation matrix.
|
static void |
convertQuaternionToMatrix(QuaternionReadOnly quaternion,
RotationMatrix matrixToPack) |
Converts the given quaternion into a rotation matrix.
|
static void |
convertRotationVectorToMatrix(double rx,
double ry,
double rz,
RotationMatrix matrixToPack) |
Converts the given rotation vector into a rotation matrix.
|
static void |
convertRotationVectorToMatrix(Vector3DReadOnly rotationVector,
RotationMatrix matrixToPack) |
Converts the given rotation vector into a rotation matrix.
|
static void |
convertYawPitchRollToMatrix(double[] yawPitchRoll,
RotationMatrix matrixToPack) |
Converts the given yaw-pitch-roll angles into a rotation matrix.
|
static void |
convertYawPitchRollToMatrix(double yaw,
double pitch,
double roll,
RotationMatrix matrixToPack) |
Converts the given yaw-pitch-roll angles into a rotation matrix.
|
public static final double EPS
public static void computeYawMatrix(double yaw, RotationMatrix matrixToPack)
yaw
.
/ cos(yaw) -sin(yaw) 0 \ this = | sin(yaw) cos(yaw) 0 | \ 0 0 1 /
yaw
- the angle to rotate about the z-axis.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void computePitchMatrix(double pitch, RotationMatrix matrixToPack)
pitch
.
/ cos(pitch) 0 sin(pitch) \ this = | 0 1 0 | \ -sin(pitch) 0 cos(pitch) /
pitch
- the angle to rotate about the y-axis.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void computeRollMatrix(double roll, RotationMatrix matrixToPack)
roll
.
/ 1 0 0 \ this = | 0 cos(roll) -sin(roll) | \ 0 sin(roll) cos(roll) /
roll
- the angle to rotate about the x-axis.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertAxisAngleToMatrix(AxisAngleReadOnly axisAngle, RotationMatrix matrixToPack)
After calling this method, the axis-angle and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix is set to
Double.NaN
.
EPS
, the rotation matrix is set to identity.
axisAngle
- the axis-angle to use for the conversion. Not modified.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertAxisAngleToMatrix(double ux, double uy, double uz, double angle, RotationMatrix matrixToPack)
After calling this method, the axis-angle and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix is set to
Double.NaN
.
EPS
, the rotation matrix is set to identity.
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.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertQuaternionToMatrix(QuaternionReadOnly quaternion, RotationMatrix matrixToPack)
After calling this method, the quaternion and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix is set to
Double.NaN
.
EPS
, the rotation matrix is set to identity.
quaternion
- the quaternion to use for the conversion. Not modified.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertQuaternionToMatrix(double qx, double qy, double qz, double qs, RotationMatrix matrixToPack)
After calling this method, the quaternion and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix is set to
Double.NaN
.
EPS
, the rotation matrix is set to identity.
qx
- the x-component of the quaternion.qy
- the y-component of the quaternion.qz
- the z-component of the quaternion.qs
- the s-component of the quaternion.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertYawPitchRollToMatrix(double[] yawPitchRoll, RotationMatrix matrixToPack)
After calling this method, the yaw-pitch-roll angles and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix 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)
/ cos(yaw) -sin(yaw) 0 \ / cos(pitch) 0 sin(pitch) \ / 1 0 0 \ R = | sin(yaw) cos(yaw) 0 | * | 0 1 0 | * | 0 cos(roll) -sin(roll) | \ 0 0 1 / \ -sin(pitch) 0 cos(pitch) / \ 0 sin(roll) cos(roll) /
yawPitchRoll
- the yaw-pitch-roll angles to use in the conversion. Not modified.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertYawPitchRollToMatrix(double yaw, double pitch, double roll, RotationMatrix matrixToPack)
After calling this method, the yaw-pitch-roll angles and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix 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)
/ cos(yaw) -sin(yaw) 0 \ / cos(pitch) 0 sin(pitch) \ / 1 0 0 \ R = | sin(yaw) cos(yaw) 0 | * | 0 1 0 | * | 0 cos(roll) -sin(roll) | \ 0 0 1 / \ -sin(pitch) 0 cos(pitch) / \ 0 sin(roll) cos(roll) /
yaw
- the angle to rotate about the z-axis.pitch
- the angle to rotate about the y-axis.roll
- the angle to rotate about the x-axis.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertRotationVectorToMatrix(Vector3DReadOnly rotationVector, RotationMatrix matrixToPack)
After calling this method, the rotation vector and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix 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.matrixToPack
- the rotation matrix in which the result is stored. Modified.public static void convertRotationVectorToMatrix(double rx, double ry, double rz, RotationMatrix matrixToPack)
After calling this method, the rotation vector and the rotation matrix represent the same orientation.
Edge case:
Double.NaN
, the rotation matrix 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.matrixToPack
- the rotation matrix in which the result is stored. Modified.