Clearable
, EpsilonComparable<RotationScaleMatrix>
, GeometricallyComparable<RotationScaleMatrix>
, Settable<RotationScaleMatrix>
, Matrix3DBasics
, Matrix3DReadOnly
, RotationScaleMatrixReadOnly
public class RotationScaleMatrix extends java.lang.Object implements Matrix3DBasics, RotationScaleMatrixReadOnly, Settable<RotationScaleMatrix>, EpsilonComparable<RotationScaleMatrix>, GeometricallyComparable<RotationScaleMatrix>
RotationScaleMatrix
is a 3-by-3 matrix that represents a 3D orientation times a
diagonal matrix holding on scale factors.
The application is mostly for 3D graphics where objects are scaled in their local coordinates and rotated.
A rotation-scale matrix M is equal to: M = R * S . Where R is a rotation matrix, and S is a scaling matrix as follows:
/ sx 0 0 \ S = | 0 sy 0 | \ 0 0 sz /where sx, sy, and sz three non-zero positive scale factors.
Note: To conserve the form M = R * S , the algebra with a rotation-scale matrix is rather restrictive. For instance, an rotation-scale matrix cannot be inverted. However, it can still perform the inverse of the transform it represents on geometry objects.
A best effort has been put in the interface of RotationScaleMatrix
to maximize the use of
the inherent properties of its composition and to minimize manipulation errors resulting in an
improper rotation-scale matrix.
Constructor | Description |
---|---|
RotationScaleMatrix() |
Create a new rotation-scale matrix initialized to identity.
|
RotationScaleMatrix(double[] rotationScaleMatrixArray) |
Creates a new rotation-scale matrix and initializes it from the given array.
|
RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationScaleMatrix) |
Creates a new rotation-scale matrix that is the same as
rotationScaleMatrix . |
RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationMatrix,
double scale) |
Creates a new rotation-scale matrix with the rotation part initialized to the
rotationMatrix and all three scale factors initialized to scale . |
RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationMatrix,
double scaleX,
double scaleY,
double scaleZ) |
Creates a new rotation-scale matrix with the rotation part initialized to the
rotationMatrix and all three scale factors initialized to scaleX , scaleY ,
and scaleZ . |
RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationMatrix,
Tuple3DReadOnly scales) |
Creates a new rotation-scale matrix with the rotation part initialized to the
rotationMatrix and all three scale factors initialized to scales . |
RotationScaleMatrix(Matrix3DReadOnly rotationScaleMatrix) |
Creates a new rotation-scale matrix that is the same as
rotationScaleMatrix . |
RotationScaleMatrix(RotationMatrixReadOnly rotationMatrix,
double scale) |
Creates a new rotation-scale matrix with the rotation part initialized to the
rotationMatrix and all three scale factors initialized to scale . |
RotationScaleMatrix(RotationMatrixReadOnly rotationMatrix,
double scaleX,
double scaleY,
double scaleZ) |
Creates a new rotation-scale matrix with the rotation part initialized to the
rotationMatrix and all three scale factors initialized to scaleX , scaleY ,
and scaleZ . |
RotationScaleMatrix(RotationMatrixReadOnly rotationMatrix,
Tuple3DReadOnly scales) |
Creates a new rotation-scale matrix with the rotation part initialized to the
rotationMatrix and all three scale factors initialized to scales . |
RotationScaleMatrix(RotationScaleMatrix other) |
Creates a new rotation-scale matrix that is the same as
other . |
RotationScaleMatrix(Orientation3DReadOnly orientation,
double scale) |
Creates a new rotation-scale matrix with the rotation part initialized to the
orientation
and all three scale factors initialized to scale . |
RotationScaleMatrix(Orientation3DReadOnly orientation,
double scaleX,
double scaleY,
double scaleZ) |
Creates a new rotation-scale matrix with the rotation part initialized to the
orientation
and all three scale factors initialized to scaleX , scaleY , and scaleZ . |
RotationScaleMatrix(Orientation3DReadOnly orientation,
Tuple3DReadOnly scales) |
Creates a new rotation-scale matrix with the rotation part initialized to the
orientation
and all three scale factors initialized to scales . |
Modifier and Type | Method | Description |
---|---|---|
void |
append(Orientation3DReadOnly orientation) |
Appends the given orientation to the rotation part of
this . |
void |
appendInvertOther(Orientation3DReadOnly orientation) |
Appends the inverse of the given orientation to the rotation part of
this . |
void |
appendInvertThis(Orientation3DReadOnly orientation) |
Inverts the rotation part of
this and appends the given orientation. |
void |
appendPitchRotation(double pitch) |
Appends a rotation about the y-axis to the rotation part of this rotation-scale matrix.
|
void |
appendRollRotation(double roll) |
Appends a rotation about the x-axis to the rotation part of this rotation-scale matrix.
|
void |
appendYawRotation(double yaw) |
Appends a rotation about the z-axis to the rotation part of this rotation-scale matrix.
|
void |
checkIfRotationMatrixProper() |
Asserts that the rotation part of this rotation-scale matrix is proper.
|
void |
checkIfRotationScaleMatrixProper() |
Asserts that this rotation-scale matrix is proper.
|
void |
checkIfScalesProper() |
Asserts that the scale part of this rotation-scale matrix is proper.
|
boolean |
containsNaN() |
Tests if at least one element of this matrix is equal to Double.NaN.
|
boolean |
epsilonEquals(RotationScaleMatrix other,
double epsilon) |
Tests the rotation parts and scales of both matrices are equal 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
equals(RotationScaleMatrix) , it returns false otherwise or if the object
is null . |
boolean |
equals(RotationScaleMatrix other) |
Tests if the rotation parts and scales of both matrices are exactly equal.
|
boolean |
geometricallyEquals(RotationScaleMatrix other,
double epsilon) |
Tests if
this and other represent the same rotation-scale to an epsilon . |
RotationMatrix |
getRotationMatrix() |
Returns the reference to the rotation matrix used to compose this rotation-scale matrix.
|
Vector3DReadOnly |
getScale() |
Returns the read-only reference to the scale factors used to compose this rotation-scale matrix.
|
int |
hashCode() |
Calculates and returns a hash code value from the value of each component of this matrix.
|
void |
normalizeRotationMatrix() |
Orthonormalization of the rotation part of this rotation-scale matrix using the
Gram-Schmidt method.
|
void |
prepend(Orientation3DReadOnly orientation) |
Prepends the given orientation to the rotation part of
this . |
void |
prependInvertOther(Orientation3DReadOnly orientation) |
Prepends the inverse of the given orientation to the rotation part of
this . |
void |
prependInvertThis(Orientation3DReadOnly orientation) |
Inverts the rotation part of
this and prepends the given orientation. |
void |
prependPitchRotation(double pitch) |
Prepend a rotation about the y-axis to the rotation part of this rotation-scale matrix.
|
void |
prependRollRotation(double roll) |
Prepend a rotation about the x-axis to the rotation part of this rotation-scale matrix.
|
void |
prependYawRotation(double yaw) |
Prepend a rotation about the z-axis to the rotation part of this rotation-scale matrix.
|
void |
resetScale() |
Resets all the scale factors to 1.0.
|
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(org.ejml.data.DenseMatrix64F rotationMatrix,
double scale) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scale . |
void |
set(org.ejml.data.DenseMatrix64F rotationMatrix,
double scaleX,
double scaleY,
double scaleZ) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scaleX , scaleY , and scaleZ . |
void |
set(org.ejml.data.DenseMatrix64F rotationMatrix,
Tuple3DReadOnly scales) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scales . |
void |
set(Matrix3DReadOnly rotationMatrix,
double scale) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scale . |
void |
set(Matrix3DReadOnly rotationMatrix,
double scaleX,
double scaleY,
double scaleZ) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scaleX , scaleY , and scaleZ . |
void |
set(Matrix3DReadOnly rotationMatrix,
Tuple3DReadOnly scales) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scales . |
void |
set(RotationMatrixReadOnly rotationMatrix) |
Sets the rotation part to the given rotation matrix and resets the scales.
|
void |
set(RotationMatrixReadOnly rotationMatrix,
double scale) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scale . |
void |
set(RotationMatrixReadOnly rotationMatrix,
double scaleX,
double scaleY,
double scaleZ) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scaleX , scaleY , and scaleZ . |
void |
set(RotationMatrixReadOnly rotationMatrix,
Tuple3DReadOnly scales) |
Sets the rotation part to the
rotationMatrix and all three scale factors to
scales . |
void |
set(RotationScaleMatrixReadOnly other) |
Sets this rotation-scale matrix to equal the given one
other . |
void |
set(RotationScaleMatrix other) |
Sets this rotation-scale matrix to equal the given one
other . |
void |
set(Orientation3DReadOnly orientation,
double scale) |
Sets the rotation part to the
orientation and all three scale factors to scale . |
void |
set(Orientation3DReadOnly orientation,
double scaleX,
double scaleY,
double scaleZ) |
Sets the rotation part to the
orientation and all three scale factors to scaleX ,
scaleY , and scaleZ . |
void |
set(Orientation3DReadOnly orientation,
Tuple3DReadOnly scales) |
Sets the rotation part to the
orientation and all three scale factors to scales . |
void |
setEuler(double rotX,
double rotY,
double rotZ) |
Resets the scale factors and sets the rotation part to represent the same orientation as the
given Euler angles
rotX , rotY , and rotZ . |
void |
setEuler(Vector3DReadOnly eulerAngles) |
Resets the scale factors and sets the rotation part to represent the same orientation as the
given Euler angles
eulerAngles . |
void |
setIdentity() |
Sets this matrix to identity:
|
void |
setRotation(double[] rotationMatrixArray) |
Sets the rotation part to
rotationMatrixArray . |
void |
setRotation(org.ejml.data.DenseMatrix64F rotationMatrix) |
Sets the rotation part to
rotationMatrix . |
void |
setRotation(Matrix3DReadOnly rotationMatrix) |
Sets the rotation part to
rotationMatrix . |
void |
setRotation(RotationMatrixReadOnly rotationMatrix) |
Sets the rotation part to
rotationMatrix . |
void |
setRotation(Orientation3DReadOnly orientation) |
Sets the rotation part to
orientation . |
void |
setRotation(Vector3DReadOnly rotationVector) |
Sets the rotation part to the rotation vector
rotationVector . |
void |
setRotationEuler(double rotX,
double rotY,
double rotZ) |
Sets the rotation part to represent the same orientation as the given Euler angles
rotX ,
rotY , and rotZ . |
void |
setRotationEuler(Vector3DReadOnly eulerAngles) |
Sets the rotation part to represent the same orientation as the given Euler angles
eulerAngles . |
void |
setRotationPitch(double pitch) |
Sets the rotation part to represent a counter clockwise rotation around the y-axis of an angle
pitch . |
void |
setRotationRoll(double roll) |
Sets the rotation part to represent a counter clockwise rotation around the x-axis of an angle
roll . |
void |
setRotationToZero() |
Sets the rotation part to represent a 'zero' rotation.
|
void |
setRotationYaw(double yaw) |
Sets the rotation part to represent a counter clockwise rotation around the z-axis of an angle
yaw . |
void |
setRotationYawPitchRoll(double[] yawPitchRoll) |
Sets the rotation part to represent the same orientation as the given yaw-pitch-roll angles
yawPitchRoll . |
void |
setRotationYawPitchRoll(double yaw,
double pitch,
double roll) |
Sets the rotation part to represent the same orientation as the given yaw-pitch-roll angles
yaw , pitch , and roll . |
void |
setScale(double scale) |
Sets all the scale factors to
scale . |
void |
setScale(double scaleX,
double scaleY,
double scaleZ) |
Sets all the scale factors to
scale . |
void |
setScale(Tuple3DReadOnly scales) |
Sets the scale factors to
scales . |
void |
setToNaN() |
Sets this matrix to contain only Double.NaN:
|
void |
setToPitchMatrix(double pitch) |
Resets the scale factors and sets the rotation part to represent a counter clockwise rotation
around the y-axis of an angle
pitch . |
void |
setToRollMatrix(double roll) |
Resets the scale factors and sets the rotation part to represent a counter clockwise rotation
around the x-axis of an angle
roll . |
void |
setToYawMatrix(double yaw) |
Resets the scale factors and sets the rotation part to represent a counter clockwise rotation
around the z-axis of an angle
yaw . |
void |
setToZero() |
Sets this rotation-scale matrix to identity representing a 'zero' rotation without scale.
|
void |
setYawPitchRoll(double[] yawPitchRoll) |
Resets the scale factors and sets the rotation part to represent the same orientation as the
given yaw-pitch-roll angles
yawPitchRoll . |
void |
setYawPitchRoll(double yaw,
double pitch,
double roll) |
Resets the scale factors and sets the rotation part to represent the same orientation as the
given yaw-pitch-roll angles
yaw , pitch , and roll . |
java.lang.String |
toString() |
Provides a
String representation of this matrix as follows: m00, m01, m02 m10, m11, m12 m20, m21, m22 |
set, set, set, set, set
addTransform, checkIfMatrix2D, checkIfRotationMatrix, determinant, epsilonEquals, equals, get, get, get, get, getColumn, getColumn, getElement, getRow, getRow, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, isIdentity, isIdentity, isMatrix2D, isMatrix2D, isMatrixSkewSymmetric, isMatrixSkewSymmetric, isRotationMatrix, isRotationMatrix, transform, transform, transform, transform, transform, transform
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
addTransform, epsilonEquals, geometricallyEquals, getM00, getM01, getM02, getM10, getM11, getM12, getM20, getM21, getM22, getMaxScale, getRotation, getRotation, getRotation, getRotation, getRotationEuler, getRotationPitch, getRotationRoll, getRotationYaw, getRotationYawPitchRoll, getScale, getScaleX, getScaleY, getScaleZ, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, inverseTransform, transform, transform, transform, transform, transform, transform, transform, transform
public RotationScaleMatrix()
public RotationScaleMatrix(RotationScaleMatrix other)
other
.other
- the other 3D matrix to copy the values from. Not modified.public RotationScaleMatrix(Matrix3DReadOnly rotationScaleMatrix)
rotationScaleMatrix
.rotationScaleMatrix
- the other 3D matrix to copy the values from. Not modified.NotARotationScaleMatrixException
- if the resulting matrix is not a rotation-scale matrix.public RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationScaleMatrix)
rotationScaleMatrix
.rotationScaleMatrix
- the other 3D matrix to copy the values from. Not modified.NotARotationScaleMatrixException
- if the resulting matrix is not a rotation-scale matrix.public RotationScaleMatrix(double[] rotationScaleMatrixArray)
/ rotationScaleMatrixArray[0] rotationScaleMatrixArray[1] rotationScaleMatrixArray[2] \ this = | rotationScaleMatrixArray[3] rotationScaleMatrixArray[4] rotationScaleMatrixArray[5] | \ rotationScaleMatrixArray[6] rotationScaleMatrixArray[7] rotationScaleMatrixArray[8] /
rotationScaleMatrixArray
- the array containing the values for this matrix. Not modified.NotARotationScaleMatrixException
- if the resulting matrix is not a rotation-scale matrix.public RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationMatrix, double scale)
rotationMatrix
and all three scale factors initialized to scale
.rotationMatrix
- the 3-by-3 matrix used to initialize the rotation part. Not modified.scale
- non-zero and positive scalar used to initialize the scale factors.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if scale <= 0.0
.public RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationMatrix, double scaleX, double scaleY, double scaleZ)
rotationMatrix
and all three scale factors initialized to scaleX
, scaleY
,
and scaleZ
.rotationMatrix
- the 3-by-3 matrix used to initialize the rotation part. Not modified.scaleX
- the non-zero and positive scalar used to initialize the x-axis scale factor.scaleY
- the non-zero and positive scalar used to initialize the y-axis scale factor.scaleZ
- the non-zero and positive scalar used to initialize the z-axis scale factor.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public RotationScaleMatrix(org.ejml.data.DenseMatrix64F rotationMatrix, Tuple3DReadOnly scales)
rotationMatrix
and all three scale factors initialized to scales
.rotationMatrix
- the 3-by-3 matrix used to initialize the rotation part. Not modified.scales
- tuple holding on the non-zero and positive scalars used to initialize the scale
factors. Not modified.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public RotationScaleMatrix(Orientation3DReadOnly orientation, double scale)
orientation
and all three scale factors initialized to scale
.orientation
- the orientation used to initialize the rotation part. Not modified.scale
- non-zero and positive scalar used to initialize the scale factors.NotARotationScaleMatrixException
- if scale <= 0.0
.public RotationScaleMatrix(Orientation3DReadOnly orientation, double scaleX, double scaleY, double scaleZ)
orientation
and all three scale factors initialized to scaleX
, scaleY
, and scaleZ
.orientation
- the orientation used to initialize the rotation part. Not modified.scaleX
- the non-zero and positive scalar used to initialize the x-axis scale factor.scaleY
- the non-zero and positive scalar used to initialize the y-axis scale factor.scaleZ
- the non-zero and positive scalar used to initialize the z-axis scale factor.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public RotationScaleMatrix(Orientation3DReadOnly orientation, Tuple3DReadOnly scales)
orientation
and all three scale factors initialized to scales
.orientation
- the orientation used to initialize the rotation part. Not modified.scales
- tuple holding on the non-zero and positive scalars used to initialize the scale
factors. Not modified.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public RotationScaleMatrix(RotationMatrixReadOnly rotationMatrix, double scale)
rotationMatrix
and all three scale factors initialized to scale
.rotationMatrix
- the rotation matrix used to initialize the rotation part. Not modified.scale
- non-zero and positive scalar used to initialize the scale factors.NotARotationScaleMatrixException
- if scale <= 0.0
.public RotationScaleMatrix(RotationMatrixReadOnly rotationMatrix, double scaleX, double scaleY, double scaleZ)
rotationMatrix
and all three scale factors initialized to scaleX
, scaleY
,
and scaleZ
.rotationMatrix
- the rotation matrix used to initialize the rotation part. Not modified.scaleX
- the non-zero and positive scalar used to initialize the x-axis scale factor.scaleY
- the non-zero and positive scalar used to initialize the y-axis scale factor.scaleZ
- the non-zero and positive scalar used to initialize the z-axis scale factor.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public RotationScaleMatrix(RotationMatrixReadOnly rotationMatrix, Tuple3DReadOnly scales)
rotationMatrix
and all three scale factors initialized to scales
.rotationMatrix
- the rotation matrix used to initialize the rotation part. Not modified.scales
- tuple holding on the non-zero and positive scalars used to initialize the scale
factors. Not modified.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void checkIfRotationScaleMatrixProper()
NotARotationScaleMatrixException
- if the rotation part is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void checkIfRotationMatrixProper()
NotARotationScaleMatrixException
- if the rotation part is not a rotation matrix.public void checkIfScalesProper()
NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void normalizeRotationMatrix()
NotARotationMatrixException
- if the orthonormalization failed.public void resetScale()
public void setToZero()
public void setToNaN()
/ NaN NaN NaN \ m = | NaN NaN NaN | \ NaN NaN NaN /
setToNaN
in interface Clearable
setToNaN
in interface Matrix3DBasics
public void setIdentity()
Matrix3DBasics
/ 1 0 0 \ m = | 0 1 0 | \ 0 0 1 /
setIdentity
in interface Matrix3DBasics
public void setRotationToZero()
public boolean containsNaN()
containsNaN
in interface Clearable
containsNaN
in interface Matrix3DBasics
containsNaN
in interface Matrix3DReadOnly
true
if at least one element of this matrix is equal to Double.NaN,
false
otherwise.public void set(RotationScaleMatrix other)
other
.set
in interface Settable<RotationScaleMatrix>
other
- the other rotation-scale matrix to copy the values from. Not modified.public void set(RotationScaleMatrixReadOnly other)
other
.other
- the other rotation-scale matrix to copy the values from. Not modified.public void set(RotationMatrixReadOnly rotationMatrix)
rotationMatrix
- the other rotation matrix to copy the values from. Not modified.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.NotARotationScaleMatrixException
- if the resulting matrix is not a rotation-scale matrix.public void set(org.ejml.data.DenseMatrix64F rotationMatrix, double scale)
rotationMatrix
and all three scale factors to
scale
.rotationMatrix
- the 3-by-3 matrix used to set the rotation part to. Not modified.scale
- non-zero and positive scalar used to initialize the scale factors.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if scale <= 0.0
.public void set(org.ejml.data.DenseMatrix64F rotationMatrix, double scaleX, double scaleY, double scaleZ)
rotationMatrix
and all three scale factors to
scaleX
, scaleY
, and scaleZ
.rotationMatrix
- the 3-by-3 matrix used to set the rotation part to. Not modified.scaleX
- the non-zero and positive scalar used to set the x-axis scale factor to.scaleY
- the non-zero and positive scalar used to set the y-axis scale factor to.scaleZ
- the non-zero and positive scalar used to set the z-axis scale factor to.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(org.ejml.data.DenseMatrix64F rotationMatrix, Tuple3DReadOnly scales)
rotationMatrix
and all three scale factors to
scales
.rotationMatrix
- the 3-by-3 matrix used to set the rotation part to. Not modified.scales
- tuple holding on the non-zero and positive scalars used to set the scale factors
to. Not modified.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(Orientation3DReadOnly orientation, double scale)
orientation
and all three scale factors to scale
.orientation
- the orientation used to set the rotation part to. Not modified.scale
- the non-zero and positive scalar used to set the scale factors to.NotARotationScaleMatrixException
- if scale <= 0.0
.public void set(Orientation3DReadOnly orientation, double scaleX, double scaleY, double scaleZ)
orientation
and all three scale factors to scaleX
,
scaleY
, and scaleZ
.orientation
- the orientation used to set the rotation part to. Not modified.scaleX
- the non-zero and positive scalar used to set the x-axis scale factor to.scaleY
- the non-zero and positive scalar used to set the y-axis scale factor to.scaleZ
- the non-zero and positive scalar used to set the z-axis scale factor to.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(Orientation3DReadOnly orientation, Tuple3DReadOnly scales)
orientation
and all three scale factors to scales
.orientation
- the orientation used to set the rotation part to. Not modified.scales
- tuple holding on the non-zero and positive scalars used to set the scale factors
to. Not modified.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(Matrix3DReadOnly rotationMatrix, double scale)
rotationMatrix
and all three scale factors to
scale
.rotationMatrix
- the matrix used to set the rotation part to. Not modified.scale
- the non-zero and positive scalar used to set the scale factors to.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if scale <= 0.0
.public void set(Matrix3DReadOnly rotationMatrix, double scaleX, double scaleY, double scaleZ)
rotationMatrix
and all three scale factors to
scaleX
, scaleY
, and scaleZ
.rotationMatrix
- the rotation matrix used to set the rotation part to. Not modified.scaleX
- the non-zero and positive scalar used to set the x-axis scale factor to.scaleY
- the non-zero and positive scalar used to set the y-axis scale factor to.scaleZ
- the non-zero and positive scalar used to set the z-axis scale factor to.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(Matrix3DReadOnly rotationMatrix, Tuple3DReadOnly scales)
rotationMatrix
and all three scale factors to
scales
.rotationMatrix
- the rotation matrix used to set the rotation part to. Not modified.scales
- tuple holding on the non-zero and positive scalars used to set the scale factors
to. Not modified.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(RotationMatrixReadOnly rotationMatrix, double scale)
rotationMatrix
and all three scale factors to
scale
.rotationMatrix
- the matrix used to set the rotation part to. Not modified.scale
- the non-zero and positive scalar used to set the scale factors to.NotARotationScaleMatrixException
- if scale <= 0.0
.public void set(RotationMatrixReadOnly rotationMatrix, double scaleX, double scaleY, double scaleZ)
rotationMatrix
and all three scale factors to
scaleX
, scaleY
, and scaleZ
.rotationMatrix
- the rotation matrix used to set the rotation part to. Not modified.scaleX
- the non-zero and positive scalar used to set the x-axis scale factor to.scaleY
- the non-zero and positive scalar used to set the y-axis scale factor to.scaleZ
- the non-zero and positive scalar used to set the z-axis scale factor to.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void set(RotationMatrixReadOnly rotationMatrix, Tuple3DReadOnly scales)
rotationMatrix
and all three scale factors to
scales
.rotationMatrix
- the rotation matrix used to set the rotation part to. Not modified.scales
- tuple holding on the non-zero and positive scalars used to set the scale factors
to. Not modified.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void setRotation(org.ejml.data.DenseMatrix64F rotationMatrix)
rotationMatrix
.rotationMatrix
- the matrix used to set the rotation part to. Not modified.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.public void setRotation(double[] rotationMatrixArray)
rotationMatrixArray
.rotationMatrixArray
- the array containing the rotation part values. Not modified.NotARotationMatrixException
- if the given rotationMatrixArray
is not a rotation
matrix.public void setRotation(Orientation3DReadOnly orientation)
orientation
.orientation
- the orientation used to set the rotation part to. Not modified.public void setRotation(Matrix3DReadOnly rotationMatrix)
rotationMatrix
.rotationMatrix
- the matrix used to set the rotation part to. Not modified.NotARotationMatrixException
- if the given rotationMatrix
is not a rotation matrix.public void setRotation(RotationMatrixReadOnly rotationMatrix)
rotationMatrix
.rotationMatrix
- the matrix used to set the rotation part to. Not modified.public void setRotation(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 set the rotation part to. Not modified.public void setRotationYaw(double yaw)
yaw
.
/ cos(yaw) -sin(yaw) 0 \ R = | sin(yaw) cos(yaw) 0 | \ 0 0 1 /
yaw
- the angle to rotate about the z-axis.public void setRotationPitch(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 setRotationRoll(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 setRotationYawPitchRoll(double[] yawPitchRoll)
yawPitchRoll
.
/ 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 Euler angles to copy the orientation from. Not modified.public void setRotationYawPitchRoll(double yaw, double pitch, double roll)
yaw
, pitch
, and 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.public void setRotationEuler(Vector3DReadOnly eulerAngles)
eulerAngles
.
/ cos(eulerAngles.z) -sin(eulerAngles.z) 0 \ / cos(eulerAngles.y) 0 sin(eulerAngles.y) \ / 1 0 0 \ R = | sin(eulerAngles.z) cos(eulerAngles.z) 0 | * | 0 1 0 | * | 0 cos(eulerAngles.x) -sin(eulerAngles.x) | \ 0 0 1 / \ -sin(eulerAngles.y) 0 cos(eulerAngles.y) / \ 0 sin(eulerAngles.x) cos(eulerAngles.x) /
This is equivalent to
this.setRotationYawPitchRoll(eulerAngles.getZ(), eulerAngles.getY(), eulerAngles.getX())
.
eulerAngles
- the Euler angles to copy the orientation from. Not modified.public void setRotationEuler(double rotX, double rotY, double rotZ)
rotX
,
rotY
, and rotZ
.
/ cos(rotZ) -sin(rotZ) 0 \ / cos(rotY) 0 sin(rotY) \ / 1 0 0 \ this = | sin(rotZ) cos(rotZ) 0 | * | 0 1 0 | * | 0 cos(rotX) -sin(rotX) | \ 0 0 1 / \ -sin(rotY) 0 cos(rotY) / \ 0 sin(rotX) cos(rotX) /
This is equivalent to this.setRotationYawPitchRoll(rotZ, rotY, rotX)
.
rotX
- the angle to rotate about the x-axis.rotY
- the angle to rotate about the y-axis.rotZ
- the angle to rotate about the z-axis.public void setScale(double scale)
scale
.scale
- the non-zero and positive scalar used to set the scale factors to.NotARotationScaleMatrixException
- if scale <= 0.0
.public void setScale(double scaleX, double scaleY, double scaleZ)
scale
.scaleX
- the non-zero and positive scalar used to set the x-axis scale factor to.scaleY
- the non-zero and positive scalar used to set the y-axis scale factor to.scaleZ
- the non-zero and positive scalar used to set the z-axis scale factor to.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.public void setScale(Tuple3DReadOnly scales)
scales
.scales
- tuple holding on the non-zero and positive scalars used to set the scale factors
to. Not modified.NotARotationScaleMatrixException
- if any of the scale factors is less or equal to zero.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 setYawPitchRoll(double[] yawPitchRoll)
yawPitchRoll
.
/ cos(yaw) -sin(yaw) 0 \ / cos(pitch) 0 sin(pitch) \ / 1 0 0 \ this = | 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 Euler angles to copy the orientation from. Not modified.public void setYawPitchRoll(double yaw, double pitch, double roll)
yaw
, pitch
, and roll
.
/ cos(yaw) -sin(yaw) 0 \ / cos(pitch) 0 sin(pitch) \ / 1 0 0 \ this = | 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.public void setEuler(Vector3DReadOnly eulerAngles)
eulerAngles
.
/ cos(eulerAngles.z) -sin(eulerAngles.z) 0 \ / cos(eulerAngles.y) 0 sin(eulerAngles.y) \ / 1 0 0 \ this = | sin(eulerAngles.z) cos(eulerAngles.z) 0 | * | 0 1 0 | * | 0 cos(eulerAngles.x) -sin(eulerAngles.x) | \ 0 0 1 / \ -sin(eulerAngles.y) 0 cos(eulerAngles.y) / \ 0 sin(eulerAngles.x) cos(eulerAngles.x) /
This is equivalent to
this.setYawPitchRoll(eulerAngles.getZ(), eulerAngles.getY(), eulerAngles.getX())
.
eulerAngles
- the Euler angles to copy the orientation from. Not modified.public void setEuler(double rotX, double rotY, double rotZ)
rotX
, rotY
, and rotZ
.
/ cos(rotZ) -sin(rotZ) 0 \ / cos(rotY) 0 sin(rotY) \ / 1 0 0 \ this = | sin(rotZ) cos(rotZ) 0 | * | 0 1 0 | * | 0 cos(rotX) -sin(rotX) | \ 0 0 1 / \ -sin(rotY) 0 cos(rotY) / \ 0 sin(rotX) cos(rotX) /
This is equivalent to this.setYawPitchRoll(rotZ, rotY, rotX)
.
rotX
- the angle to rotate about the x-axis.rotY
- the angle to rotate about the y-axis.rotZ
- the angle to rotate about the z-axis.public void append(Orientation3DReadOnly orientation)
this
.orientation
- the orientation to append to this
. Not modified.public void appendInvertThis(Orientation3DReadOnly orientation)
this
and appends the given orientation.orientation
- the orientation to append to this
. Not modified.public void appendInvertOther(Orientation3DReadOnly orientation)
this
.orientation
- the orientation to append to this
. Not modified.public void appendYawRotation(double yaw)
/ cos(yaw) -sin(yaw) 0 \ R = R * | sin(yaw) cos(yaw) 0 | \ 0 0 1 /
This method does not affect the scale part of this rotation-scale matrix.
yaw
- the angle to rotate about the z-axis.public void appendPitchRotation(double pitch)
/ cos(pitch) 0 sin(pitch) \ R = R * | 0 1 0 | \ -sin(pitch) 0 cos(pitch) /
This method does not affect the scale part of this rotation-scale matrix.
pitch
- the angle to rotate about the y-axis.public void appendRollRotation(double roll)
/ 1 0 0 \ R = R * | 0 cos(roll) -sin(roll) | \ 0 sin(roll) cos(roll) /
This method does not affect the scale part of this rotation-scale matrix.
roll
- the angle to rotate about the x-axis.public void prepend(Orientation3DReadOnly orientation)
this
.orientation
- the orientation to prepend to this
. Not modified.public void prependInvertThis(Orientation3DReadOnly orientation)
this
and prepends the given orientation.orientation
- the orientation to prepend to this
. Not modified.public void prependInvertOther(Orientation3DReadOnly orientation)
this
.orientation
- the orientation to prepend to this
. Not modified.public void prependYawRotation(double yaw)
/ cos(yaw) -sin(yaw) 0 \ R = | sin(yaw) cos(yaw) 0 | * R \ 0 0 1 /
This method does not affect the scale part of this rotation-scale matrix.
yaw
- the angle to rotate about the z-axis.public void prependPitchRotation(double pitch)
/ cos(pitch) 0 sin(pitch) \ R = | 0 1 0 | * R \ -sin(pitch) 0 cos(pitch) /
This method does not affect the scale part of this rotation-scale matrix.
pitch
- the angle to rotate about the y-axis.public void prependRollRotation(double roll)
/ 1 0 0 \ R = | 0 cos(roll) -sin(roll) | * R \ 0 sin(roll) cos(roll) /
This method does not affect the scale part of this rotation-scale matrix.
roll
- the angle to rotate about the x-axis.public RotationMatrix getRotationMatrix()
getRotationMatrix
in interface RotationScaleMatrixReadOnly
public Vector3DReadOnly getScale()
getScale
in interface RotationScaleMatrixReadOnly
public boolean equals(java.lang.Object object)
object
's class is the same as this, in which case the method returns
equals(RotationScaleMatrix)
, 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 equals(RotationScaleMatrix other)
The method returns false
if the given matrix is null
.
other
- the other matrix to compare against this. Not modified.true
if the two matrices are exactly equal, 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
public boolean epsilonEquals(RotationScaleMatrix other, double epsilon)
epsilon
.epsilonEquals
in interface EpsilonComparable<RotationScaleMatrix>
other
- the other matrix to compare against this. Not modified.epsilon
- tolerance to use when comparing each component.true
if the two matrix are equal, false
otherwise.public boolean geometricallyEquals(RotationScaleMatrix other, double epsilon)
this
and other
represent the same rotation-scale to an epsilon
.
Two rotation-scale matrices are considered geometrically equal if the their respective rotation matrices and scale vectors are geometrically equal.
Note that this.geometricallyEquals(other, epsilon) == true
does not necessarily imply
this.epsilonEquals(other, epsilon)
and vice versa.
geometricallyEquals
in interface GeometricallyComparable<RotationScaleMatrix>
other
- the other rotation-scale matrix to compare against this. Not modified.epsilon
- the threshold used when comparing the internal rotation and scale to
other
's rotation and scale.true
if the two rotation-scale matrices represent the same geometry,
false
otherwise.