Clearable
, EpsilonComparable<RotationMatrix>
, GeometricallyComparable<RotationMatrix>
, GeometryObject<RotationMatrix>
, Settable<RotationMatrix>
, Transformable
, Matrix3DBasics
, Matrix3DReadOnly
, RotationMatrixReadOnly
, Orientation3DBasics
, Orientation3DReadOnly
public class RotationMatrix extends java.lang.Object implements Matrix3DBasics, RotationMatrixReadOnly, Orientation3DBasics, GeometryObject<RotationMatrix>
RotationMatrix
is a 3-by-3 matrix used to represent 3d orientations.
A rotation matrix has to comply to several constraints:
1
.
A best effort has been put in the interface of RotationMatrix
to maximize the use of the
inherent properties of a rotation matrix and to minimize manipulation errors resulting in an
improper rotation matrix.
ORIENTATION_2D_EPSILON
Constructor | Description |
---|---|
RotationMatrix() |
Create a new rotation matrix initialized to identity.
|
RotationMatrix(double[] rotationMatrixArray) |
Creates a new rotation matrix and initializes it from the given array.
|
RotationMatrix(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22) |
Creates a new rotation matrix and initializes it from the given 9 coefficients.
|
RotationMatrix(org.ejml.data.DenseMatrix64F rotationMatrix) |
Creates a new rotation matrix that is the same as
rotationMatrix . |
RotationMatrix(Matrix3DReadOnly rotationMatrix) |
Creates a new rotation matrix that is the same as
rotationMatrix . |
RotationMatrix(RotationMatrixReadOnly other) |
Creates a new rotation matrix that is the same as
other . |
RotationMatrix(Orientation3DReadOnly orientation) |
Creates a new rotation matrix that represents the same orientation as the given one.
|
RotationMatrix(Vector3DReadOnly rotationVector) |
Creates a new rotation matrix representing the same orientation as the given rotation vector
rotationVector . |
Modifier and Type | Method | Description |
---|---|---|
void |
append(Orientation3DReadOnly orientation) |
Appends the given orientation to this orientation.
|
void |
appendInvertOther(Orientation3DReadOnly orientation) |
Appends the inverse of the given orientation to this orientation.
|
void |
appendPitchRotation(double pitch) |
Append a rotation about the y-axis to this rotation matrix.
|
void |
appendRollRotation(double roll) |
Append a rotation about the x-axis to this rotation matrix.
|
void |
appendYawRotation(double yaw) |
Append a rotation about the z-axis to this rotation matrix.
|
void |
applyInverseTransform(Transform transform) |
Transform this using the inverse of the given
transform . |
void |
applyTransform(Transform transform) |
Transform this using the given
transform . |
boolean |
epsilonEquals(RotationMatrix other,
double epsilon) |
Tests on a per coefficient basis if this matrix is equal to the given
other to an
epsilon . |
boolean |
equals(java.lang.Object object) |
Tests if the given
object 's class is the same as this, in which case the method returns
Matrix3DReadOnly.equals(Matrix3DReadOnly) , it returns false otherwise or if the object is
null . |
boolean |
geometricallyEquals(RotationMatrix other,
double epsilon) |
Tests if
this and other represent the same orientation to an epsilon . |
double |
getM00() |
Gets the 1st row 1st column coefficient of this matrix.
|
double |
getM01() |
Gets the 1st row 2nd column coefficient of this matrix.
|
double |
getM02() |
Gets the 1st row 3rd column coefficient of this matrix.
|
double |
getM10() |
Gets the 2nd row 1st column coefficient of this matrix.
|
double |
getM11() |
Gets the 2nd row 2nd column coefficient of this matrix.
|
double |
getM12() |
Gets the 2nd row 3rd column coefficient of this matrix.
|
double |
getM20() |
Gets the 3rd row 1st column coefficient of this matrix.
|
double |
getM21() |
Gets the 3rd row 2nd column coefficient of this matrix.
|
double |
getM22() |
Gets the 3rd row 3rd column coefficient of this matrix.
|
int |
hashCode() |
Calculates and returns a hash code value from the value of each component of this matrix.
|
void |
interpolate(RotationMatrixReadOnly rf,
double alpha) |
Performs a linear interpolation in SO(3) from
this to rf given the percentage
alpha . |
void |
interpolate(RotationMatrixReadOnly r0,
RotationMatrixReadOnly rf,
double alpha) |
Performs a linear interpolation in SO(3) from
r0 to rf given the percentage
alpha . |
void |
invert() |
Inverts this rotation matrix.
|
void |
multiply(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
multiplyTransposeBoth(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
multiplyTransposeOther(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
multiplyTransposeThis(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
normalize() |
Orthonormalization of the rotation matrix using the
Gram-Schmidt method.
|
void |
preMultiply(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
preMultiplyTransposeBoth(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
preMultiplyTransposeOther(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
preMultiplyTransposeThis(RotationMatrixReadOnly other) |
Performs a matrix multiplication on this.
|
void |
prepend(Orientation3DReadOnly orientation) |
Prepends the given orientation to this orientation.
|
void |
prependInvertOther(Orientation3DReadOnly orientation) |
Prepends the inverse of the given orientation to this orientation.
|
void |
prependPitchRotation(double pitch) |
Prepend a rotation about the y-axis to this rotation matrix.
|
void |
prependRollRotation(double roll) |
Append a rotation about the x-axis to this rotation matrix.
|
void |
prependYawRotation(double yaw) |
Prepend a rotation about the z-axis to this rotation matrix.
|
void |
set(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22) |
Sets the 9 coefficients of this matrix to the given ones.
|
void |
set(RotationMatrixReadOnly other) |
Sets this rotation matrix to equal the given one
other . |
void |
set(RotationMatrix other) |
Sets this rotation matrix to equal the given one
other . |
void |
set(Orientation3DReadOnly orientation3DReadOnly) |
Converts, if necessary, and sets this orientation to represents the same orientation as
orientation3DReadOnly . |
void |
setAndInvert(Matrix3DReadOnly matrix) |
Sets this rotation matrix to the invert of the given
matrix . |
void |
setAndInvert(RotationMatrixReadOnly other) |
Sets this rotation matrix to the invert of the given one
other . |
void |
setAndNormalize(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22) |
Sets the 9 coefficients of this rotation matrix and then normalizes
this . |
void |
setAndNormalize(Matrix3DReadOnly matrix) |
Sets this rotation matrix to equal the 3D matrix
matrix and then normalizes this . |
void |
setAndNormalize(RotationMatrixReadOnly other) |
Sets this rotation matrix to equal the given
other and then normalizes this . |
void |
setAndTranspose(Matrix3DReadOnly matrix) |
Sets this rotation matrix to the transpose of the given
matrix . |
void |
setAndTranspose(RotationMatrixReadOnly other) |
Sets this rotation matrix to the transpose of the given
other . |
void |
setAxisAngle(double x,
double y,
double z,
double angle) |
Sets this orientation to represents the same orientation as an axis-angle given its 4
components.
|
void |
setColumns(Tuple3DReadOnly firstColumn,
Tuple3DReadOnly secondColumn,
Tuple3DReadOnly thirdColumn) |
Sets this rotation matrix from the given tuples each holding on the values of each column.
|
void |
setQuaternion(double x,
double y,
double z,
double s) |
Sets this orientation to represents the same orientation as a quaternion given its 4
components.
|
void |
setRotationMatrix(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22) |
Sets this orientation to represents the same orientation as a rotation matrix given its 9
components.
|
void |
setRotationVector(double x,
double y,
double z) |
Sets this orientation to represents the same orientation as a rotation vector given its 3
components.
|
void |
setRows(Tuple3DReadOnly firstRow,
Tuple3DReadOnly secondRow,
Tuple3DReadOnly thirdRow) |
Sets this rotation matrix from the given tuples each holding on the values of each row.
|
void |
setToPitchMatrix(double pitch) |
Sets this rotation matrix to represent a counter clockwise rotation around the y-axis of an angle
pitch . |
void |
setToRollMatrix(double roll) |
Sets this rotation matrix to represent a counter clockwise rotation around the x-axis of an angle
roll . |
void |
setToYawMatrix(double yaw) |
Sets this rotation matrix to represent a counter clockwise rotation around the z-axis of an angle
yaw . |
void |
setToZero() |
Sets this rotation matrix to identity representing a 'zero' rotation.
|
void |
setUnsafe(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22) |
Sets the 9 coefficients of this rotation matrix without performing any checks on the data
provided.
|
void |
setYawPitchRoll(double yaw,
double pitch,
double roll) |
Sets this orientation to represents the same orientation as a yaw-pitch-roll representation.
|
java.lang.String |
toString() |
Provides a
String representation of this matrix as follows: m00, m01, m02 m10, m11, m12 m20, m21, m22 |
void |
transpose() |
Transposes this matrix: m = mT.
|
containsNaN, set, set, set, set, set, setIdentity, setToNaN
checkIfMatrix2D, checkIfRotationMatrix, determinant, epsilonEquals, equals, get, get, get, get, getColumn, getColumn, getElement, getRow, getRow, isIdentity, isIdentity, isMatrix2D, isMatrix2D, isMatrixSkewSymmetric, isMatrixSkewSymmetric, isRotationMatrix, isRotationMatrix
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
appendInvertBoth, appendInvertThis, prependInvertBoth, prependInvertThis, setAndInvert, setAndNormalize, setEuler, setEuler, setRotationVector, setYawPitchRoll
checkIfOrientation2D, checkIfOrientation2D, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isOrientation2D, toStringAsYawPitchRoll, transform, transform, transform, transform, transform, transform
addTransform, addTransform, distance, geometricallyEquals, get, get, get, get, getEuler, getPitch, getRoll, getRotationVector, getYaw, getYawPitchRoll, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isOrientation2D, transform, transform, transform, transform, transform, transform, transform, transform, transform, transform
public RotationMatrix()
public RotationMatrix(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
m00
- the 1st row 1st column coefficient for this matrix.m01
- the 1st row 2nd column coefficient for this matrix.m02
- the 1st row 3rd column coefficient for this matrix.m10
- the 2nd row 1st column coefficient for this matrix.m11
- the 2nd row 2nd column coefficient for this matrix.m12
- the 2nd row 3rd column coefficient for this matrix.m20
- the 3rd row 1st column coefficient for this matrix.m21
- the 3rd row 2nd column coefficient for this matrix.m22
- the 3rd row 3rd column coefficient for this matrix.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public RotationMatrix(double[] rotationMatrixArray)
/ rotationMatrixArray[0] rotationMatrixArray[1] rotationMatrixArray[2] \ this = | rotationMatrixArray[3] rotationMatrixArray[4] rotationMatrixArray[5] | \ rotationMatrixArray[6] rotationMatrixArray[7] rotationMatrixArray[8] /
rotationMatrixArray
- the array containing the values for this matrix. Not modified.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public RotationMatrix(org.ejml.data.DenseMatrix64F rotationMatrix)
rotationMatrix
.rotationMatrix
- the other 3D matrix to copy the values from. Not modified.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public RotationMatrix(Matrix3DReadOnly rotationMatrix)
rotationMatrix
.rotationMatrix
- the other 3D matrix to copy the values from. Not modified.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public RotationMatrix(RotationMatrixReadOnly other)
other
.other
- the other 3D matrix to copy the values from. Not modified.public RotationMatrix(Orientation3DReadOnly orientation)
orientation
- the orientation used to initialize this rotation matrix. Not modified.public RotationMatrix(Vector3DReadOnly rotationVector)
rotationVector
.
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 used to initialize this rotation matrix. Not modified.public void setToZero()
public void normalize()
normalize
in interface Orientation3DBasics
NotARotationMatrixException
- if the orthonormalization failed.public void transpose()
public void setUnsafe(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
This method is meant for internal usage. Prefer using
set(double, double, double, double, double, double, double, double, double)
or
setAndNormalize(double, double, double, double, double, double, double, double, double)
.
m00
- the new 1st row 1st column coefficient for this matrix.m01
- the new 1st row 2nd column coefficient for this matrix.m02
- the new 1st row 3rd column coefficient for this matrix.m10
- the new 2nd row 1st column coefficient for this matrix.m11
- the new 2nd row 2nd column coefficient for this matrix.m12
- the new 2nd row 3rd column coefficient for this matrix.m20
- the new 3rd row 1st column coefficient for this matrix.m21
- the new 3rd row 2nd column coefficient for this matrix.m22
- the new 3rd row 3rd column coefficient for this matrix.public void set(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
set
in interface Matrix3DBasics
m00
- the new 1st row 1st column coefficient for this matrix.m01
- the new 1st row 2nd column coefficient for this matrix.m02
- the new 1st row 3rd column coefficient for this matrix.m10
- the new 2nd row 1st column coefficient for this matrix.m11
- the new 2nd row 2nd column coefficient for this matrix.m12
- the new 2nd row 3rd column coefficient for this matrix.m20
- the new 3rd row 1st column coefficient for this matrix.m21
- the new 3rd row 2nd column coefficient for this matrix.m22
- the new 3rd row 3rd column coefficient for this matrix.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public void setRows(Tuple3DReadOnly firstRow, Tuple3DReadOnly secondRow, Tuple3DReadOnly thirdRow)
/ firstRow.getX() firstRow.getY() firstRow.getZ() \ this = | secondRow.getX() secondRow.getY() secondRow.getZ() | \ thirdRow.getX() thirdRow.getY() thirdRow.getZ() /
firstRow
- the tuple holding onto the values of the first row. Not modified.secondRow
- the tuple holding onto the values of the second row. Not modified.thirdRow
- the tuple holding onto the values of the third row. Not modified.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public void setColumns(Tuple3DReadOnly firstColumn, Tuple3DReadOnly secondColumn, Tuple3DReadOnly thirdColumn)
/ firstColumn.getX() secondColumn.getX() thirdColumn.getX() \ this = | firstColumn.getY() secondColumn.getY() thirdColumn.getY() | \ firstColumn.getZ() secondColumn.getZ() thirdColumn.getZ() /
firstColumn
- the tuple holding onto the values of the first column. Not modified.secondColumn
- the tuple holding onto the values of the second column. Not modified.thirdColumn
- the tuple holding onto the values of the third column. Not modified.NotARotationMatrixException
- if the resulting matrix is not a rotation matrix.public void setAndNormalize(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
this
.m00
- the new 1st row 1st column coefficient for this matrix.m01
- the new 1st row 2nd column coefficient for this matrix.m02
- the new 1st row 3rd column coefficient for this matrix.m10
- the new 2nd row 1st column coefficient for this matrix.m11
- the new 2nd row 2nd column coefficient for this matrix.m12
- the new 2nd row 3rd column coefficient for this matrix.m20
- the new 3rd row 1st column coefficient for this matrix.m21
- the new 3rd row 2nd column coefficient for this matrix.m22
- the new 3rd row 3rd column coefficient for this matrix.NotARotationMatrixException
- if the normalization failed.public void set(RotationMatrix other)
other
.set
in interface Settable<RotationMatrix>
other
- the other rotation matrix to copy the values from. Not modified.public void set(RotationMatrixReadOnly other)
other
.other
- the other rotation matrix to copy the values from. Not modified.public void set(Orientation3DReadOnly orientation3DReadOnly)
Orientation3DBasics
orientation3DReadOnly
.set
in interface Orientation3DBasics
orientation3DReadOnly
- the new orientation. Not modified.public void setAndNormalize(Matrix3DReadOnly matrix)
matrix
and then normalizes this
.matrix
- the matrix to copy the values from. Not modified.NotARotationMatrixException
- if the normalization failed.public void setAndNormalize(RotationMatrixReadOnly other)
other
and then normalizes this
.other
- the rotation matrix to copy the values from. Not modified.NotARotationMatrixException
- if the normalization failed.public void setAndInvert(Matrix3DReadOnly matrix)
matrix
.
This operation uses the property:
R-1 = RT
of a rotation matrix preventing to actually compute the inverse of the matrix.
matrix
- the matrix to copy the values from. Not modified.NotARotationMatrixException
- if matrix
is not a rotation matrix.public void setAndInvert(RotationMatrixReadOnly other)
other
.
This operation uses the property:
R-1 = RT
of a rotation matrix preventing to actually compute the inverse of the matrix.
other
- the matrix to copy the values from. Not modified.public void setAndTranspose(Matrix3DReadOnly matrix)
matrix
.matrix
- the matrix to copy the values from. Not modified.NotARotationMatrixException
- if matrix
is not a rotation matrix.public void setAndTranspose(RotationMatrixReadOnly other)
other
.other
- the matrix to copy the values from. Not modified.public void setAxisAngle(double x, double y, double z, double angle)
Orientation3DBasics
setAxisAngle
in interface Orientation3DBasics
x
- x-component of the axis part of the axis-angle.y
- y-component of the axis part of the axis-angle.z
- z-component of the axis part of the axis-angle.angle
- the angle part of the axis-angle.public void setRotationVector(double x, double y, double z)
Orientation3DBasics
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.
setRotationVector
in interface Orientation3DBasics
x
- the x-component of the rotation vector.y
- the y-component of the rotation vector.z
- the z-component of the rotation vector.public void setQuaternion(double x, double y, double z, double s)
Orientation3DBasics
setQuaternion
in interface Orientation3DBasics
x
- the x-component of the quaternion.y
- the y-component of the quaternion.z
- the z-component of the quaternion.s
- the s-component of the quaternion.public void setYawPitchRoll(double yaw, double pitch, double roll)
Orientation3DBasics
WARNING: the Euler angles or yaw-pitch-roll representation is sensitive to gimbal lock and is sometimes undefined.
The yaw-pitch-roll representation describes a 3D orientation as a succession of three rotations around three axes:
As an example, a rotation matrix can be computed from a yaw-pitch-roll representation as follows:
/ 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) /
setYawPitchRoll
in interface Orientation3DBasics
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.public void setRotationMatrix(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
Orientation3DBasics
setRotationMatrix
in interface Orientation3DBasics
m00
- the new 1st row 1st column coefficient of the rotation matrix.m01
- the new 1st row 2nd column coefficient of the rotation matrix.m02
- the new 1st row 3rd column coefficient of the rotation matrix.m10
- the new 2nd row 1st column coefficient of the rotation matrix.m11
- the new 2nd row 2nd column coefficient of the rotation matrix.m12
- the new 2nd row 3rd column coefficient of the rotation matrix.m20
- the new 3rd row 1st column coefficient of the rotation matrix.m21
- the new 3rd row 2nd column coefficient of the rotation matrix.m22
- the new 3rd row 3rd column coefficient of the rotation matrix.public void setToYawMatrix(double yaw)
yaw
.
/ cos(yaw) -sin(yaw) 0 \ this = | sin(yaw) cos(yaw) 0 | \ 0 0 1 /
yaw
- the angle to rotate about the z-axis.public void setToPitchMatrix(double pitch)
pitch
.
/ cos(pitch) 0 sin(pitch) \ this = | 0 1 0 | \ -sin(pitch) 0 cos(pitch) /
pitch
- the angle to rotate about the y-axis.public void setToRollMatrix(double roll)
roll
.
/ 1 0 0 \ this = | 0 cos(roll) -sin(roll) | \ 0 sin(roll) cos(roll) /
roll
- the angle to rotate about the x-axis.public void invert()
This operation uses the property:
R-1 = RT
of a rotation matrix preventing to actually compute the inverse of the matrix.
This is equivalent to this.transpose()
.
invert
in interface Orientation3DBasics
public void multiply(RotationMatrixReadOnly other)
this = this * other
other
- the other matrix to multiply this by. Not modified.public void append(Orientation3DReadOnly orientation)
Orientation3DBasics
Let's consider the following:
this
represents the orientation of B relative to A.
orientation
represents the orientation of C relative to B.
this
, represents the orientation of
C relative to A.
Appending orientations is in some way similar to summing translations. However, while the
addition for translation is commutative, the "append" operation on orientation is NOT
commutative. Such that: this.append(orientation)
≠
orientation.append(this)
.
append
in interface Orientation3DBasics
orientation
- the orientation to append to this orientation. Not modified.public void multiplyTransposeThis(RotationMatrixReadOnly other)
this = thisT * other
other
- the other matrix to multiply this by. Not modified.public void multiplyTransposeOther(RotationMatrixReadOnly other)
this = this * otherT
other
- the other matrix to multiply this by. Not modified.public void appendInvertOther(Orientation3DReadOnly orientation)
Orientation3DBasics
Let's consider the following:
this
represents the orientation of B relative to A.
orientation
represents the orientation of B relative to C.
this
, represents the orientation of
C relative to A.
This operation is in some way similar to subtracting translations, as in this operation can be
seen as subtracting orientation
to this
.
appendInvertOther
in interface Orientation3DBasics
orientation
- the orientation which the inverse is to be appended to this orientation.
Not modified.public void multiplyTransposeBoth(RotationMatrixReadOnly other)
this = thisT * otherT
other
- the other matrix to multiply this by. Not modified.public void appendYawRotation(double yaw)
/ cos(yaw) -sin(yaw) 0 \ this = this * | sin(yaw) cos(yaw) 0 | \ 0 0 1 /
appendYawRotation
in interface Orientation3DBasics
yaw
- the angle to rotate about the z-axis.public void appendPitchRotation(double pitch)
/ cos(pitch) 0 sin(pitch) \ this = this * | 0 1 0 | \ -sin(pitch) 0 cos(pitch) /
appendPitchRotation
in interface Orientation3DBasics
pitch
- the angle to rotate about the y-axis.public void appendRollRotation(double roll)
/ cos(pitch) 0 sin(pitch) \ this = this * | 0 1 0 | \ -sin(pitch) 0 cos(pitch) /
appendRollRotation
in interface Orientation3DBasics
roll
- the angle to rotate about the x-axis.public void preMultiply(RotationMatrixReadOnly other)
this = other * this
other
- the other matrix to multiply this by. Not modified.public void prepend(Orientation3DReadOnly orientation)
Orientation3DBasics
Let's consider the following:
this
represents the orientation of C relative to B.
orientation
represents the orientation of B relative to A.
this
, represents the orientation of
C relative to A.
Prepending orientations is in some way similar to summing translations. However, while the
addition for translation is commutative, the "prepend" operation on orientation is NOT
commutative. Such that: this.prepend(orientation)
≠
orientation.prepend(this)
.
prepend
in interface Orientation3DBasics
orientation
- the orientation to prepend to this orientation. Not modified.public void preMultiplyTransposeThis(RotationMatrixReadOnly other)
this = other * thisT
other
- the other matrix to multiply this by. Not modified.public void preMultiplyTransposeOther(RotationMatrixReadOnly other)
this = otherT * this
other
- the other matrix to multiply this by. Not modified.public void prependInvertOther(Orientation3DReadOnly orientation)
Orientation3DBasics
Let's consider the following:
this
represents the orientation of B relative to C.
orientation
represents the orientation of B relative to A.
this
, represents the orientation of
C relative to A.
This operation is in some way similar to subtracting translations, as in this operation can be
seen as subtracting orientation
to this
.
prependInvertOther
in interface Orientation3DBasics
orientation
- the orientation which the inverse is to be appended to this orientation.
Not modified.public void preMultiplyTransposeBoth(RotationMatrixReadOnly other)
this = otherT * thisT
other
- the other matrix to multiply this by. Not modified.public void prependYawRotation(double yaw)
/ cos(yaw) -sin(yaw) 0 \ this = | sin(yaw) cos(yaw) 0 | * this \ 0 0 1 /
prependYawRotation
in interface Orientation3DBasics
yaw
- the angle to rotate about the z-axis.public void prependPitchRotation(double pitch)
/ cos(pitch) 0 sin(pitch) \ this = | 0 1 0 | * this \ -sin(pitch) 0 cos(pitch) /
prependPitchRotation
in interface Orientation3DBasics
pitch
- the angle to rotate about the y-axis.public void prependRollRotation(double roll)
/ cos(pitch) 0 sin(pitch) \ this = | 0 1 0 | * this \ -sin(pitch) 0 cos(pitch) /
prependRollRotation
in interface Orientation3DBasics
roll
- the angle to rotate about the x-axis.public void interpolate(RotationMatrixReadOnly rf, double alpha)
this
to rf
given the percentage
alpha
.
This is equivalent to but much more computationally expensive than the Spherical Linear Interpolation performed with quaternions.
rf
- the other rotation matrix used for the interpolation. Not modified.alpha
- the percentage used for the interpolation. A value of 0 will result in not modifying
this rotation matrix, while a value of 1 is equivalent to setting this rotation matrix
to rf
.public void interpolate(RotationMatrixReadOnly r0, RotationMatrixReadOnly rf, double alpha)
r0
to rf
given the percentage
alpha
.
This is equivalent to but much more computationally expensive than the Spherical Linear Interpolation performed with quaternions.
r0
- the first rotation matrix used in the interpolation. Not modified.rf
- the second rotation matrix used in the interpolation. Not modified.alpha
- the percentage to use for the interpolation. A value of 0 will result in setting
this rotation matrix to r0
, while a value of 1 is equivalent to setting this
rotation matrix to rf
.public void applyTransform(Transform transform)
transform
.
this = R * this where 'R' is the 3-by-3 matrix representing the rotation part of the
transform
.
Note: the transformation of a RotationMatrix
strongly differs from the transformation of
a Matrix3D
.
applyTransform
in interface Transformable
transform
- the transform to use on this. Not modified.public void applyInverseTransform(Transform transform)
transform
.
this = RT * this where 'R' is the 3-by-3 matrix representing the rotation part of the
transform
.
Note: the transformation of a RotationMatrix
strongly differs from the transformation of
a Matrix3D
.
applyInverseTransform
in interface Transformable
transform
- the transform to use on this. Not modified.public double getM00()
getM00
in interface Matrix3DReadOnly
public double getM01()
getM01
in interface Matrix3DReadOnly
public double getM02()
getM02
in interface Matrix3DReadOnly
public double getM10()
getM10
in interface Matrix3DReadOnly
public double getM11()
getM11
in interface Matrix3DReadOnly
public double getM12()
getM12
in interface Matrix3DReadOnly
public double getM20()
getM20
in interface Matrix3DReadOnly
public double getM21()
getM21
in interface Matrix3DReadOnly
public double getM22()
getM22
in interface Matrix3DReadOnly
public boolean equals(java.lang.Object object)
object
's class is the same as this, in which case the method returns
Matrix3DReadOnly.equals(Matrix3DReadOnly)
, it returns false
otherwise or if the object
is
null
.equals
in class java.lang.Object
object
- the object to compare against this. Not modified.true
if object
and this are exactly equal, false
otherwise.public boolean epsilonEquals(RotationMatrix other, double epsilon)
other
to an
epsilon
.epsilonEquals
in interface EpsilonComparable<RotationMatrix>
other
- the other matrix to compare against this. Not modified.epsilon
- the tolerance to use when comparing each component.true
if the two matrices are equal, false
otherwise.public boolean geometricallyEquals(RotationMatrix other, double epsilon)
this
and other
represent the same orientation to an epsilon
.
Two rotation matrices are considered geometrically equal if the magnitude of their difference is
less than or equal to epsilon
.
Note that this.geometricallyEquals(other, epsilon) == true
does not necessarily imply
this.epsilonEquals(other, epsilon)
and vice versa.
geometricallyEquals
in interface GeometricallyComparable<RotationMatrix>
other
- the other rotation matrix to compare against this. Not modified.epsilon
- the maximum angle between the two rotation matrices to be considered equal.true
if the two rotation matrices represent the same geometry, false
otherwise.public java.lang.String toString()
String
representation of this matrix as follows: toString
in class java.lang.Object
String
representing this matrix.public int hashCode()
hashCode
in class java.lang.Object