Interface Matrix3dc
- All Known Implementing Classes:
Matrix3d,Matrix3dStack
- Author:
- Kai Burjack
-
Method Summary
Modifier and TypeMethodDescriptionComponent-wise addthisandotherand store the result indest.Compute the cofactor matrix ofthisand store it intodest.doubleReturn the determinant of this matrix.booleanCompare the matrix elements ofthismatrix with the given matrix using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.double[]get(double[] arr) Store this matrix into the supplied double array in column-major order.double[]get(double[] arr, int offset) Store this matrix into the supplied double array in column-major order at the given offset.float[]get(float[] arr) Store the elements of this matrix as float values in column-major order into the supplied float array.float[]get(float[] arr, int offset) Store the elements of this matrix as float values in column-major order into the supplied float array at the given offset.doubleget(int column, int row) Get the matrix element value at the given column and row.get(int index, ByteBuffer buffer) Store this matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.get(int index, DoubleBuffer buffer) Store this matrix into the suppliedDoubleBufferstarting at the specified absolute buffer position/index using column-major order.get(int index, FloatBuffer buffer) Store this matrix in column-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.get(ByteBuffer buffer) Store this matrix in column-major order into the suppliedByteBufferat the current bufferposition.get(DoubleBuffer buffer) Store this matrix into the suppliedDoubleBufferat the current bufferpositionusing column-major order.get(FloatBuffer buffer) Store this matrix in column-major order into the suppliedFloatBufferat the current bufferposition.Get the current values ofthismatrix and store them intodest.Get the column at the givencolumnindex, starting with0.getEulerAnglesXYZ(Vector3d dest) Extract the Euler angles from the rotation represented bythismatrix and store the extracted Euler angles indest.getEulerAnglesZYX(Vector3d dest) Extract the Euler angles from the rotation represented bythismatrix and store the extracted Euler angles indest.getFloats(int index, ByteBuffer buffer) Store the elements of this matrix as float values in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.getFloats(ByteBuffer buffer) Store the elements of this matrix as float values in column-major order into the suppliedByteBufferat the current bufferposition.Get the current values ofthismatrix and store the represented rotation into the givenQuaterniond.Get the current values ofthismatrix and store the represented rotation into the givenQuaternionf.getRotation(AxisAngle4f dest) Get the current values ofthismatrix and store the represented rotation into the givenAxisAngle4f.Get the row at the givenrowindex, starting with0.doublegetRowColumn(int row, int column) Get the matrix element value at the given row and column.Get the scaling factors ofthismatrix for the three base axes.getToAddress(long address) Store this matrix in column-major order at the given off-heap address.getTransposed(int index, ByteBuffer buffer) Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.getTransposed(int index, DoubleBuffer buffer) Store this matrix in row-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.getTransposed(int index, FloatBuffer buffer) Store this matrix in row-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.getTransposed(ByteBuffer buffer) Store this matrix in row-major order into the suppliedByteBufferat the current bufferposition.getTransposed(DoubleBuffer buffer) Store this matrix in row-major order into the suppliedDoubleBufferat the current bufferposition.getTransposed(FloatBuffer buffer) Store this matrix in row-major order into the suppliedFloatBufferat the current bufferposition.getTransposedFloats(int index, ByteBuffer buffer) Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.getTransposedFloats(ByteBuffer buffer) Store this matrix as float values in row-major order into the suppliedByteBufferat the current bufferposition.Get the current values ofthismatrix and store the represented rotation into the givenQuaterniond.Get the current values ofthismatrix and store the represented rotation into the givenQuaternionf.Invertthismatrix and store the result indest.booleanisFinite()Linearly interpolatethisandotherusing the given interpolation factortand store the result indest.Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.doublem00()Return the value of the matrix element at column 0 and row 0.doublem01()Return the value of the matrix element at column 0 and row 1.doublem02()Return the value of the matrix element at column 0 and row 2.doublem10()Return the value of the matrix element at column 1 and row 0.doublem11()Return the value of the matrix element at column 1 and row 1.doublem12()Return the value of the matrix element at column 1 and row 2.doublem20()Return the value of the matrix element at column 2 and row 0.doublem21()Return the value of the matrix element at column 2 and row 1.doublem22()Return the value of the matrix element at column 2 and row 2.Multiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixMultiply this matrix by the supplied matrix and store the result indest.Multiply this matrix by the supplied matrix and store the result indest.mulComponentWise(Matrix3dc other, Matrix3d dest) Component-wise multiplythisbyotherand store the result indest.Pre-multiply this matrix by the suppliedleftmatrix and store the result indest.Multiplythisby the matrixMultiplythisby the matrixMultiplythisby the matrixCompute a normal matrix fromthismatrix and store it intodest.Obtain the direction of+Xbefore the transformation represented bythisorthogonal matrix is applied.Obtain the direction of+Ybefore the transformation represented bythisorthogonal matrix is applied.Obtain the direction of+Zbefore the transformation represented bythisorthogonal matrix is applied.Apply an oblique projection transformation to this matrix with the given values foraandband store the result indest.Obtain the direction of+Xbefore the transformation represented bythismatrix is applied.Obtain the direction of+Ybefore the transformation represented bythismatrix is applied.Obtain the direction of+Zbefore the transformation represented bythismatrix is applied.doublequadraticFormProduct(double x, double y, double z) Compute(x, y, z)^T * this * (x, y, z).doubleComputev^T * this * v.doubleComputev^T * this * v.Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal(nx, ny, nz), and store the result indest.reflect(Quaterniondc orientation, Matrix3d dest) Apply a mirror/reflection transformation to this matrix that reflects through a plane specified via the plane orientation, and store the result indest.Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal, and store the result indest.Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components, and store the result indest.Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.rotate(AxisAngle4d axisAngle, Matrix3d dest) Apply a rotation transformation, rotating about the givenAxisAngle4dand store the result indest.rotate(AxisAngle4f axisAngle, Matrix3d dest) Apply a rotation transformation, rotating about the givenAxisAngle4fand store the result indest.rotate(Quaterniondc quat, Matrix3d dest) Apply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.rotate(Quaternionfc quat, Matrix3d dest) Apply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.rotateLocal(double ang, double x, double y, double z, Matrix3d dest) Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified(x, y, z)axis and store the result indest.rotateLocal(Quaterniondc quat, Matrix3d dest) Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.rotateLocal(Quaternionfc quat, Matrix3d dest) Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.rotateLocalX(double ang, Matrix3d dest) Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result indest.rotateLocalY(double ang, Matrix3d dest) Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians about the Y axis and store the result indest.rotateLocalZ(double ang, Matrix3d dest) Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result indest.rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest) Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirand store the result indest.rotateTowards(Vector3dc direction, Vector3dc up, Matrix3d dest) Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirectionand store the result indest.Apply rotation about the X axis to this matrix by rotating the given amount of radians and store the result indest.Apply rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.Apply rotation about the Y axis to this matrix by rotating the given amount of radians and store the result indest.Apply rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.Apply rotation about the Z axis to this matrix by rotating the given amount of radians and store the result indest.Apply rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians about the X axis and store the result indest.Apply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result indest.Apply scaling to this matrix by uniformly scaling all base axes by the givenxyzfactor and store the result indest.Apply scaling tothismatrix by scaling the base axes by the givenxyz.x,xyz.yandxyz.zfactors, respectively and store the result indest.scaleLocal(double x, double y, double z, Matrix3d dest) Pre-multiply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.Component-wise subtractsubtrahendfromthisand store the result indest.Transform the vector(x, y, z)by this matrix and store the result indest.Transform the given vector by this matrix.Transform the given vector by this matrix and store the result indest.Transform the given vector by this matrix.Transform the given vector by this matrix and store the result indest.transformTranspose(double x, double y, double z, Vector3d dest) Transform the vector(x, y, z)by the transpose of this matrix and store the result indest.Transform the given vector by the transpose of this matrix.transformTranspose(Vector3dc v, Vector3d dest) Transform the given vector by the transpose of this matrix and store the result indest.Transposethismatrix and store the result indest.
-
Method Details
-
m00
double m00()Return the value of the matrix element at column 0 and row 0.- Returns:
- the value of the matrix element
-
m01
double m01()Return the value of the matrix element at column 0 and row 1.- Returns:
- the value of the matrix element
-
m02
double m02()Return the value of the matrix element at column 0 and row 2.- Returns:
- the value of the matrix element
-
m10
double m10()Return the value of the matrix element at column 1 and row 0.- Returns:
- the value of the matrix element
-
m11
double m11()Return the value of the matrix element at column 1 and row 1.- Returns:
- the value of the matrix element
-
m12
double m12()Return the value of the matrix element at column 1 and row 2.- Returns:
- the value of the matrix element
-
m20
double m20()Return the value of the matrix element at column 2 and row 0.- Returns:
- the value of the matrix element
-
m21
double m21()Return the value of the matrix element at column 2 and row 1.- Returns:
- the value of the matrix element
-
m22
double m22()Return the value of the matrix element at column 2 and row 2.- Returns:
- the value of the matrix element
-
mul
Multiply this matrix by the supplied matrix and store the result indest. This matrix will be the left one.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!- Parameters:
right- the right operanddest- will hold the result- Returns:
- dest
-
mulLocal
Pre-multiply this matrix by the suppliedleftmatrix and store the result indest.If
Misthismatrix andLtheleftmatrix, then the new matrix will beL * M. So when transforming a vectorvwith the new matrix by usingL * M * v, the transformation ofthismatrix will be applied first!- Parameters:
left- the left operand of the matrix multiplicationdest- the destination matrix, which will hold the result- Returns:
- dest
-
mul
Multiply this matrix by the supplied matrix and store the result indest. This matrix will be the left one.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!- Parameters:
right- the right operanddest- will hold the result- Returns:
- dest
-
determinant
double determinant()Return the determinant of this matrix.- Returns:
- the determinant
-
invert
Invertthismatrix and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
transpose
Transposethismatrix and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
get
Get the current values ofthismatrix and store them intodest.- Parameters:
dest- the destination matrix- Returns:
- the passed in destination
-
getRotation
Get the current values ofthismatrix and store the represented rotation into the givenAxisAngle4f.- Parameters:
dest- the destinationAxisAngle4f- Returns:
- the passed in destination
- See Also:
-
getUnnormalizedRotation
Get the current values ofthismatrix and store the represented rotation into the givenQuaternionf.This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.
- Parameters:
dest- the destinationQuaternionf- Returns:
- the passed in destination
- See Also:
-
getNormalizedRotation
Get the current values ofthismatrix and store the represented rotation into the givenQuaternionf.This method assumes that the three column vectors of this matrix are normalized.
- Parameters:
dest- the destinationQuaternionf- Returns:
- the passed in destination
- See Also:
-
getUnnormalizedRotation
Get the current values ofthismatrix and store the represented rotation into the givenQuaterniond.This method assumes that the three column vectors of this matrix are not normalized and thus allows to ignore any additional scaling factor that is applied to the matrix.
- Parameters:
dest- the destinationQuaterniond- Returns:
- the passed in destination
- See Also:
-
getNormalizedRotation
Get the current values ofthismatrix and store the represented rotation into the givenQuaterniond.This method assumes that the three column vectors of this matrix are normalized.
- Parameters:
dest- the destinationQuaterniond- Returns:
- the passed in destination
- See Also:
-
get
Store this matrix into the suppliedDoubleBufferat the current bufferpositionusing column-major order.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer} at which the matrix is stored, use
get(int, DoubleBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
get
Store this matrix into the suppliedDoubleBufferstarting at the specified absolute buffer position/index using column-major order.This method will not increment the position of the given
DoubleBuffer.- Parameters:
index- the absolute position into theDoubleBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get
Store this matrix in column-major order into the suppliedFloatBufferat the current bufferposition.This method will not increment the position of the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which the matrix is stored, use
get(int, FloatBuffer), taking the absolute position as parameter.Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
get
Store this matrix in column-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given FloatBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Parameters:
index- the absolute position into the FloatBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get
Store this matrix in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
get(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
get
Store this matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
getFloats
Store the elements of this matrix as float values in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
getFloats(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the elements of this matrix as float values in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
getFloats
Store the elements of this matrix as float values in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the elements of this matrix as float values in column-major order- Returns:
- the passed in buffer
-
getTransposed
Store this matrix in row-major order into the suppliedDoubleBufferat the current bufferposition.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which the matrix is stored, use
getTransposed(int, DoubleBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
getTransposed
Store this matrix in row-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given DoubleBuffer.
- Parameters:
index- the absolute position into the DoubleBufferbuffer- will receive the values of this matrix in row-major order- Returns:
- the passed in buffer
-
getTransposed
Store this matrix in row-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
getTransposed(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
getTransposed
Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix in row-major order- Returns:
- the passed in buffer
-
getTransposed
Store this matrix in row-major order into the suppliedFloatBufferat the current bufferposition.This method will not increment the position of the given FloatBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which the matrix is stored, use
getTransposed(int, FloatBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
getTransposed
Store this matrix in row-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given FloatBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Parameters:
index- the absolute position into the FloatBufferbuffer- will receive the values of this matrix in row-major order- Returns:
- the passed in buffer
-
getTransposedFloats
Store this matrix as float values in row-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
getTransposedFloats(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix as float values in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
-
getTransposedFloats
Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix as float values in row-major order- Returns:
- the passed in buffer
-
getToAddress
Store this matrix in column-major order at the given off-heap address.This method will throw an
UnsupportedOperationExceptionwhen JOML is used with `-Djoml.nounsafe`.This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.
- Parameters:
address- the off-heap address where to store this matrix- Returns:
- this
-
get
double[] get(double[] arr, int offset) Store this matrix into the supplied double array in column-major order at the given offset.- Parameters:
arr- the array to write the matrix values intooffset- the offset into the array- Returns:
- the passed in array
-
get
double[] get(double[] arr) Store this matrix into the supplied double array in column-major order.In order to specify an explicit offset into the array, use the method
get(double[], int).- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
-
get
float[] get(float[] arr, int offset) Store the elements of this matrix as float values in column-major order into the supplied float array at the given offset.Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given float array.
- Parameters:
arr- the array to write the matrix values intooffset- the offset into the array- Returns:
- the passed in array
-
get
float[] get(float[] arr) Store the elements of this matrix as float values in column-major order into the supplied float array.Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given float array.
In order to specify an explicit offset into the array, use the method
get(float[], int).- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
-
scale
Apply scaling tothismatrix by scaling the base axes by the givenxyz.x,xyz.yandxyz.zfactors, respectively and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xyz- the factors of the x, y and z component, respectivelydest- will hold the result- Returns:
- dest
-
scale
Apply scaling to this matrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
x- the factor of the x componenty- the factor of the y componentz- the factor of the z componentdest- will hold the result- Returns:
- dest
-
scale
Apply scaling to this matrix by uniformly scaling all base axes by the givenxyzfactor and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xyz- the factor for all componentsdest- will hold the result- Returns:
- dest
- See Also:
-
scaleLocal
Pre-multiply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!- Parameters:
x- the factor of the x componenty- the factor of the y componentz- the factor of the z componentdest- will hold the result- Returns:
- dest
-
transform
Transform the given vector by this matrix.- Parameters:
v- the vector to transform- Returns:
- v
-
transform
Transform the given vector by this matrix and store the result indest.- Parameters:
v- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
Transform the given vector by this matrix.- Parameters:
v- the vector to transform- Returns:
- v
-
transform
Transform the given vector by this matrix and store the result indest.- Parameters:
v- the vector to transformdest- will hold the result- Returns:
- dest
-
transform
Transform the vector(x, y, z)by this matrix and store the result indest.- Parameters:
x- the x coordinate of the vector to transformy- the y coordinate of the vector to transformz- the z coordinate of the vector to transformdest- will hold the result- Returns:
- dest
-
transformTranspose
Transform the given vector by the transpose of this matrix.- Parameters:
v- the vector to transform- Returns:
- v
-
transformTranspose
Transform the given vector by the transpose of this matrix and store the result indest.- Parameters:
v- the vector to transformdest- will hold the result- Returns:
- dest
-
transformTranspose
Transform the vector(x, y, z)by the transpose of this matrix and store the result indest.- Parameters:
x- the x coordinate of the vector to transformy- the y coordinate of the vector to transformz- the z coordinate of the vector to transformdest- will hold the result- Returns:
- dest
-
rotateX
Apply rotation about the X axis to this matrix by rotating the given amount of radians and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansdest- will hold the result- Returns:
- dest
-
rotateY
Apply rotation about the Y axis to this matrix by rotating the given amount of radians and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansdest- will hold the result- Returns:
- dest
-
rotateZ
Apply rotation about the Z axis to this matrix by rotating the given amount of radians and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansdest- will hold the result- Returns:
- dest
-
rotateXYZ
Apply rotation ofangleXradians about the X axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateX(angleX, dest).rotateY(angleY).rotateZ(angleZ)- Parameters:
angleX- the angle to rotate about XangleY- the angle to rotate about YangleZ- the angle to rotate about Zdest- will hold the result- Returns:
- dest
-
rotateZYX
Apply rotation ofangleZradians about the Z axis, followed by a rotation ofangleYradians about the Y axis and followed by a rotation ofangleXradians about the X axis and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateZ(angleZ, dest).rotateY(angleY).rotateX(angleX)- Parameters:
angleZ- the angle to rotate about ZangleY- the angle to rotate about YangleX- the angle to rotate about Xdest- will hold the result- Returns:
- dest
-
rotateYXZ
Apply rotation ofangleYradians about the Y axis, followed by a rotation ofangleXradians about the X axis and followed by a rotation ofangleZradians about the Z axis and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!This method is equivalent to calling:
rotateY(angleY, dest).rotateX(angleX).rotateZ(angleZ)- Parameters:
angleY- the angle to rotate about YangleX- the angle to rotate about XangleZ- the angle to rotate about Zdest- will hold the result- Returns:
- dest
-
rotate
Apply rotation to this matrix by rotating the given amount of radians about the given axis specified as x, y and z components, and store the result indest.The axis described by the three components needs to be a unit vector.
When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansx- the x component of the axisy- the y component of the axisz- the z component of the axisdest- will hold the result- Returns:
- dest
-
rotateLocal
Pre-multiply a rotation to this matrix by rotating the given amount of radians about the specified(x, y, z)axis and store the result indest.The axis described by the three components needs to be a unit vector.
When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansx- the x component of the axisy- the y component of the axisz- the z component of the axisdest- will hold the result- Returns:
- dest
-
rotateLocalX
Pre-multiply a rotation around the X axis to this matrix by rotating the given amount of radians about the X axis and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians to rotate about the X axisdest- will hold the result- Returns:
- dest
-
rotateLocalY
Pre-multiply a rotation around the Y axis to this matrix by rotating the given amount of radians about the Y axis and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians to rotate about the Y axisdest- will hold the result- Returns:
- dest
-
rotateLocalZ
Pre-multiply a rotation around the Z axis to this matrix by rotating the given amount of radians about the Z axis and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radians to rotate about the Z axisdest- will hold the result- Returns:
- dest
-
rotateLocal
Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beQ * M. So when transforming a vectorvwith the new matrix by usingQ * M * v, the quaternion rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaterniondcdest- will hold the result- Returns:
- dest
-
rotateLocal
Pre-multiply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beQ * M. So when transforming a vectorvwith the new matrix by usingQ * M * v, the quaternion rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaternionfcdest- will hold the result- Returns:
- dest
-
rotate
Apply the rotation - and possibly scaling - transformation of the givenQuaterniondcto this matrix and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beM * Q. So when transforming a vectorvwith the new matrix by usingM * Q * v, the quaternion rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaterniondcdest- will hold the result- Returns:
- dest
-
rotate
Apply the rotation - and possibly scaling - transformation of the givenQuaternionfcto this matrix and store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andQthe rotation matrix obtained from the given quaternion, then the new matrix will beM * Q. So when transforming a vectorvwith the new matrix by usingM * Q * v, the quaternion rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
quat- theQuaternionfcdest- will hold the result- Returns:
- dest
-
rotate
Apply a rotation transformation, rotating about the givenAxisAngle4fand store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andAthe rotation matrix obtained from the givenAxisAngle4f, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, theAxisAngle4frotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
axisAngle- theAxisAngle4f(needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
-
rotate
Apply a rotation transformation, rotating about the givenAxisAngle4dand store the result indest.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andAthe rotation matrix obtained from the givenAxisAngle4d, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, theAxisAngle4drotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
axisAngle- theAxisAngle4d(needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
-
rotate
Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.The axis described by the
axisvector needs to be a unit vector.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andAthe rotation matrix obtained from the given axis and angle, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, the axis-angle rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
angle- the angle in radiansaxis- the rotation axis (needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
-
rotate
Apply a rotation transformation, rotating the given radians about the specified axis and store the result indest.The axis described by the
axisvector needs to be a unit vector.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
If
Misthismatrix andAthe rotation matrix obtained from the given axis and angle, then the new matrix will beM * A. So when transforming a vectorvwith the new matrix by usingM * A * v, the axis-angle rotation will be applied first!Reference: http://en.wikipedia.org
- Parameters:
angle- the angle in radiansaxis- the rotation axis (needs to benormalized)dest- will hold the result- Returns:
- dest
- See Also:
-
getRow
Get the row at the givenrowindex, starting with0.- Parameters:
row- the row index in[0..2]dest- will hold the row components- Returns:
- the passed in destination
- Throws:
IndexOutOfBoundsException- ifrowis not in[0..2]
-
getColumn
Get the column at the givencolumnindex, starting with0.- Parameters:
column- the column index in[0..2]dest- will hold the column components- Returns:
- the passed in destination
- Throws:
IndexOutOfBoundsException- ifcolumnis not in[0..2]
-
get
double get(int column, int row) Get the matrix element value at the given column and row.- Parameters:
column- the colum index in[0..2]row- the row index in[0..2]- Returns:
- the element value
-
getRowColumn
double getRowColumn(int row, int column) Get the matrix element value at the given row and column.- Parameters:
row- the row index in[0..2]column- the colum index in[0..2]- Returns:
- the element value
-
normal
Compute a normal matrix fromthismatrix and store it intodest.The normal matrix of
mis the transpose of the inverse ofm.- Parameters:
dest- will hold the result- Returns:
- dest
-
cofactor
Compute the cofactor matrix ofthisand store it intodest.The cofactor matrix can be used instead of
normal(Matrix3d)to transform normals when the orientation of the normals with respect to the surface should be preserved.- Parameters:
dest- will hold the result- Returns:
- dest
-
lookAlong
Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.If
Misthismatrix andLthe lookalong rotation matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookalong rotation transformation will be applied first!- Parameters:
dir- the direction in space to look alongup- the direction of 'up'dest- will hold the result- Returns:
- dest
- See Also:
-
lookAlong
Matrix3d lookAlong(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest) Apply a rotation transformation to this matrix to make-zpoint alongdirand store the result indest.If
Misthismatrix andLthe lookalong rotation matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookalong rotation transformation will be applied first!- Parameters:
dirX- the x-coordinate of the direction to look alongdirY- the y-coordinate of the direction to look alongdirZ- the z-coordinate of the direction to look alongupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vectordest- will hold the result- Returns:
- dest
-
getScale
Get the scaling factors ofthismatrix for the three base axes.- Parameters:
dest- will hold the scaling factors forx,yandz- Returns:
- dest
-
positiveZ
Obtain the direction of+Zbefore the transformation represented bythismatrix is applied.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).invert(); inv.transform(dir.set(0, 0, 1)).normalize();
Ifthisis already an orthogonal matrix, then consider usingnormalizedPositiveZ(Vector3d)instead.Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+Z- Returns:
- dir
-
normalizedPositiveZ
Obtain the direction of+Zbefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).transpose(); inv.transform(dir.set(0, 0, 1));
Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+Z- Returns:
- dir
-
positiveX
Obtain the direction of+Xbefore the transformation represented bythismatrix is applied.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).invert(); inv.transform(dir.set(1, 0, 0)).normalize();
Ifthisis already an orthogonal matrix, then consider usingnormalizedPositiveX(Vector3d)instead.Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
normalizedPositiveX
Obtain the direction of+Xbefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).transpose(); inv.transform(dir.set(1, 0, 0));
Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
positiveY
Obtain the direction of+Ybefore the transformation represented bythismatrix is applied.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).invert(); inv.transform(dir.set(0, 1, 0)).normalize();
Ifthisis already an orthogonal matrix, then consider usingnormalizedPositiveY(Vector3d)instead.Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
normalizedPositiveY
Obtain the direction of+Ybefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method is equivalent to the following code:
Matrix3d inv = new Matrix3d(this).transpose(); inv.transform(dir.set(0, 1, 0));
Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
add
Component-wise addthisandotherand store the result indest.- Parameters:
other- the other addenddest- will hold the result- Returns:
- dest
-
sub
Component-wise subtractsubtrahendfromthisand store the result indest.- Parameters:
subtrahend- the subtrahenddest- will hold the result- Returns:
- dest
-
mulComponentWise
Component-wise multiplythisbyotherand store the result indest.- Parameters:
other- the other matrixdest- will hold the result- Returns:
- dest
-
lerp
Linearly interpolatethisandotherusing the given interpolation factortand store the result indest.If
tis0.0then the result isthis. If the interpolation factor is1.0then the result isother.- Parameters:
other- the other matrixt- the interpolation factor between 0.0 and 1.0dest- will hold the result- Returns:
- dest
-
rotateTowards
Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirectionand store the result indest.If
Misthismatrix andLthe lookat matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookat transformation will be applied first!This method is equivalent to calling:
mul(new Matrix3d().lookAlong(new Vector3d(dir).negate(), up).invert(), dest)- Parameters:
direction- the direction to rotate towardsup- the model's up vectordest- will hold the result- Returns:
- dest
- See Also:
-
rotateTowards
Matrix3d rotateTowards(double dirX, double dirY, double dirZ, double upX, double upY, double upZ, Matrix3d dest) Apply a model transformation to this matrix for a right-handed coordinate system, that aligns the local+Zaxis withdirand store the result indest.If
Misthismatrix andLthe lookat matrix, then the new matrix will beM * L. So when transforming a vectorvwith the new matrix by usingM * L * v, the lookat transformation will be applied first!This method is equivalent to calling:
mul(new Matrix3d().lookAlong(-dirX, -dirY, -dirZ, upX, upY, upZ).invert(), dest)- Parameters:
dirX- the x-coordinate of the direction to rotate towardsdirY- the y-coordinate of the direction to rotate towardsdirZ- the z-coordinate of the direction to rotate towardsupX- the x-coordinate of the up vectorupY- the y-coordinate of the up vectorupZ- the z-coordinate of the up vectordest- will hold the result- Returns:
- dest
- See Also:
-
getEulerAnglesXYZ
Extract the Euler angles from the rotation represented bythismatrix and store the extracted Euler angles indest.This method assumes that
thismatrix only represents a rotation without scaling.The Euler angles are always returned as the angle around X in the
Vector3d.xfield, the angle around Y in theVector3d.yfield and the angle around Z in theVector3d.zfield of the suppliedVector3dinstance.Note that the returned Euler angles must be applied in the order
X * Y * Zto obtain the identical matrix. This means that callingrotateXYZ(double, double, double, Matrix3d)using the obtained Euler angles will yield the same rotation as the original matrix from which the Euler angles were obtained, so in the below code the matrixm2should be identical tom(disregarding possible floating-point inaccuracies).Matrix3d m = ...; // <- matrix only representing rotation Matrix3d n = new Matrix3d(); n.rotateXYZ(m.getEulerAnglesXYZ(new Vector3d()));
Reference: http://en.wikipedia.org/
- Parameters:
dest- will hold the extracted Euler angles- Returns:
- dest
-
getEulerAnglesZYX
Extract the Euler angles from the rotation represented bythismatrix and store the extracted Euler angles indest.This method assumes that
thismatrix only represents a rotation without scaling.The Euler angles are always returned as the angle around X in the
Vector3d.xfield, the angle around Y in theVector3d.yfield and the angle around Z in theVector3d.zfield of the suppliedVector3dinstance.Note that the returned Euler angles must be applied in the order
Z * Y * Xto obtain the identical matrix. This means that callingrotateZYX(double, double, double, Matrix3d)using the obtained Euler angles will yield the same rotation as the original matrix from which the Euler angles were obtained, so in the below code the matrixm2should be identical tom(disregarding possible floating-point inaccuracies).Matrix3d m = ...; // <- matrix only representing rotation Matrix3d n = new Matrix3d(); n.rotateZYX(m.getEulerAnglesZYX(new Vector3d()));
Reference: http://en.wikipedia.org/
- Parameters:
dest- will hold the extracted Euler angles- Returns:
- dest
-
obliqueZ
Apply an oblique projection transformation to this matrix with the given values foraandband store the result indest.If
Misthismatrix andOthe oblique transformation matrix, then the new matrix will beM * O. So when transforming a vectorvwith the new matrix by usingM * O * v, the oblique transformation will be applied first!The oblique transformation is defined as:
x' = x + a*z y' = y + a*z z' = z
or in matrix form:1 0 a 0 1 b 0 0 1
- Parameters:
a- the value for the z factor that applies to xb- the value for the z factor that applies to ydest- will hold the result- Returns:
- dest
-
equals
Compare the matrix elements ofthismatrix with the given matrix using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.Please note that this method is not used by any data structure such as
ArrayListHashSetorHashMapand their operations, such asArrayList.contains(Object)orHashSet.remove(Object), since those data structures only use theObject.equals(Object)andObject.hashCode()methods.- Parameters:
m- the other matrixdelta- the allowed maximum difference- Returns:
truewhether all of the matrix elements are equal;falseotherwise
-
reflect
Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal(nx, ny, nz), and store the result indest.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!- Parameters:
nx- the x-coordinate of the plane normalny- the y-coordinate of the plane normalnz- the z-coordinate of the plane normaldest- will hold the result- Returns:
- this
-
reflect
Apply a mirror/reflection transformation to this matrix that reflects through a plane specified via the plane orientation, and store the result indest.This method can be used to build a reflection transformation based on the orientation of a mirror object in the scene. It is assumed that the default mirror plane's normal is
(0, 0, 1). So, if the givenQuaterniondcis the identity (does not apply any additional rotation), the reflection plane will bez=0.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!- Parameters:
orientation- the plane orientationdest- will hold the result- Returns:
- this
-
reflect
Apply a mirror/reflection transformation to this matrix that reflects through the given plane specified via the plane normal, and store the result indest.If
Misthismatrix andRthe reflection matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the reflection will be applied first!- Parameters:
normal- the plane normaldest- will hold the result- Returns:
- this
-
isFinite
boolean isFinite()Determine whether all matrix elements are finite floating-point values, that is, they are notNaNand notinfinity.- Returns:
trueif all components are finite floating-point values;falseotherwise
-
quadraticFormProduct
double quadraticFormProduct(double x, double y, double z) Compute(x, y, z)^T * this * (x, y, z).- Parameters:
x- the x coordinate of the vector to multiplyy- the y coordinate of the vector to multiplyz- the z coordinate of the vector to multiply- Returns:
- the result
-
quadraticFormProduct
Computev^T * this * v.- Parameters:
v- the vector to multiply- Returns:
- the result
-
quadraticFormProduct
Computev^T * this * v.- Parameters:
v- the vector to multiply- Returns:
- the result
-
mapXZY
Multiplythisby the matrix1 0 0 0 0 1 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapXZnY
Multiplythisby the matrix1 0 0 0 0 -1 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapXnYnZ
Multiplythisby the matrix1 0 0 0 -1 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapXnZY
Multiplythisby the matrix1 0 0 0 0 1 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapXnZnY
Multiplythisby the matrix1 0 0 0 0 -1 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYXZ
Multiplythisby the matrix0 1 0 1 0 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYXnZ
Multiplythisby the matrix0 1 0 1 0 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYZX
Multiplythisby the matrix0 0 1 1 0 0 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYZnX
Multiplythisby the matrix0 0 -1 1 0 0 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYnXZ
Multiplythisby the matrix0 -1 0 1 0 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYnXnZ
Multiplythisby the matrix0 -1 0 1 0 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYnZX
Multiplythisby the matrix0 0 1 1 0 0 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapYnZnX
Multiplythisby the matrix0 0 -1 1 0 0 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZXY
Multiplythisby the matrix0 1 0 0 0 1 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZXnY
Multiplythisby the matrix0 1 0 0 0 -1 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZYX
Multiplythisby the matrix0 0 1 0 1 0 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZYnX
Multiplythisby the matrix0 0 -1 0 1 0 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZnXY
Multiplythisby the matrix0 -1 0 0 0 1 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZnXnY
Multiplythisby the matrix0 -1 0 0 0 -1 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZnYX
Multiplythisby the matrix0 0 1 0 -1 0 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapZnYnX
Multiplythisby the matrix0 0 -1 0 -1 0 1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXYnZ
Multiplythisby the matrix-1 0 0 0 1 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXZY
Multiplythisby the matrix-1 0 0 0 0 1 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXZnY
Multiplythisby the matrix-1 0 0 0 0 -1 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXnYZ
Multiplythisby the matrix-1 0 0 0 -1 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXnYnZ
Multiplythisby the matrix-1 0 0 0 -1 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXnZY
Multiplythisby the matrix-1 0 0 0 0 1 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnXnZnY
Multiplythisby the matrix-1 0 0 0 0 -1 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYXZ
Multiplythisby the matrix0 1 0 -1 0 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYXnZ
Multiplythisby the matrix0 1 0 -1 0 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYZX
Multiplythisby the matrix0 0 1 -1 0 0 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYZnX
Multiplythisby the matrix0 0 -1 -1 0 0 0 1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYnXZ
Multiplythisby the matrix0 -1 0 -1 0 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYnXnZ
Multiplythisby the matrix0 -1 0 -1 0 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYnZX
Multiplythisby the matrix0 0 1 -1 0 0 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnYnZnX
Multiplythisby the matrix0 0 -1 -1 0 0 0 -1 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZXY
Multiplythisby the matrix0 1 0 0 0 1 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZXnY
Multiplythisby the matrix0 1 0 0 0 -1 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZYX
Multiplythisby the matrix0 0 1 0 1 0 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZYnX
Multiplythisby the matrix0 0 -1 0 1 0 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZnXY
Multiplythisby the matrix0 -1 0 0 0 1 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZnXnY
Multiplythisby the matrix0 -1 0 0 0 -1 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZnYX
Multiplythisby the matrix0 0 1 0 -1 0 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
mapnZnYnX
Multiplythisby the matrix0 0 -1 0 -1 0 -1 0 0
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
negateX
Multiplythisby the matrix-1 0 0 0 1 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
negateY
Multiplythisby the matrix1 0 0 0 -1 0 0 0 1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
negateZ
Multiplythisby the matrix1 0 0 0 1 0 0 0 -1
and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-