Class Matrix4d
java.lang.Object
javax.vecmath.Matrix4d
- All Implemented Interfaces:
Serializable, Cloneable
A double precision floating point 4 by 4 matrix.
Primarily to support 3D rotations.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptiondoubleThe first element of the first row.doubleThe second element of the first row.doubleThe third element of the first row.doubleThe fourth element of the first row.doubleThe first element of the second row.doubleThe second element of the second row.doubleThe third element of the second row.doubleThe fourth element of the second row.doubleThe first element of the third row.doubleThe second element of the third row.doubleThe third element of the third row.doubleThe fourth element of the third row.doubleThe first element of the fourth row.doubleThe second element of the fourth row.doubleThe third element of the fourth row.doubleThe fourth element of the fourth row. -
Constructor Summary
ConstructorsConstructorDescriptionMatrix4d()Constructs and initializes a Matrix4d to all zeros.Matrix4d(double[] v) Constructs and initializes a Matrix4d from the specified 16 element array.Matrix4d(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33) Constructs and initializes a Matrix4d from the specified 16 values.Constructs and initializes a Matrix4f from the rotation matrix, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.Constructs and initializes a Matrix4d from the rotation matrix, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.Constructs a new matrix with the same values as the Matrix4d parameter.Constructs a new matrix with the same values as the Matrix4f parameter.Constructs and initializes a Matrix4d from the quaternion, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components.Constructs and initializes a Matrix4d from the quaternion, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components. -
Method Summary
Modifier and TypeMethodDescriptionfinal voidadd(double scalar) Adds a scalar to each component of this matrix.final voidAdds a scalar to each component of the matrix m1 and places the result into this.final voidSets the value of this matrix to sum of itself and matrix m1.final voidSets the value of this matrix to the matrix sum of matrices m1 and m2.clone()Creates a new object of the same class as this object.final doubleComputes the determinant of this matrix.booleanepsilonEquals(Matrix4d m1, double epsilon) Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false.booleanepsilonEquals(Matrix4d m1, float epsilon) Deprecated.Use epsilonEquals(Matrix4d,double) insteadbooleanReturns true if the Object t1 is of type Matrix4d and all of the data members of t1 are equal to the corresponding data members in this Matrix4d.booleanReturns true if all of the data members of Matrix4d m1 are equal to the corresponding data members in this Matrix4d.final voidPerforms an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3d parameter.final doublePerforms an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale.final voidPerforms an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3f parameter.final doublePerforms an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale.final voidPerforms an SVD normalization of q1 matrix in order to acquire the normalized rotational component; the values are placed into the Quat4d parameter.final voidPerforms an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Quat4f parameter.final voidRetrieves the translational components of this matrix.final voidgetColumn(int column, double[] v) Copies the matrix values in the specified column into the array parameter.final voidCopies the matrix values in the specified column into the vector parameter.final doublegetElement(int row, int column) Retrieves the value at the specified row and column of this matrix.final doublegetM00()Get the first matrix element in the first row.final doublegetM01()Get the second matrix element in the first row.final doublegetM02()Get the third matrix element in the first row.final doublegetM03()Get the fourth element of the first row.final doublegetM10()Get first matrix element in the second row.final doublegetM11()Get second matrix element in the second row.final doublegetM12()Get the third matrix element in the second row.final doublegetM13()Get the fourth element of the second row.final doublegetM20()Get the first matrix element in the third row.final doublegetM21()Get the second matrix element in the third row.final doublegetM22()Get the third matrix element in the third row.final doublegetM23()Get the fourth element of the third row.final doublegetM30()Get the first element of the fourth row.final doublegetM31()Get the second element of the fourth row.final doublegetM32()Get the third element of the fourth row.final doublegetM33()Get the fourth element of the fourth row.final voidGets the upper 3x3 values of this matrix and places them into the matrix m1.final voidGets the upper 3x3 values of this matrix and places them into the matrix m1.final voidgetRow(int row, double[] v) Copies the matrix values in the specified row into the array parameter.final voidCopies the matrix values in the specified row into the vector parameter.final doublegetScale()Performs an SVD normalization of this matrix to calculate and return the uniform scale factor.inthashCode()Returns a hash code value based on the data values in this object.final voidinvert()Inverts this matrix in place.final voidSets the value of this matrix to the matrix inverse of the passed (user declared) matrix m1.final voidmul(double scalar) Multiplies each element of this matrix by a scalar.final voidMultiplies each element of matrix m1 by a scalar and places the result into this.final voidSets the value of this matrix to the result of multiplying itself with matrix m1.final voidSets the value of this matrix to the result of multiplying the two argument matrices together.final voidmulTransposeBoth(Matrix4d m1, Matrix4d m2) Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.final voidmulTransposeLeft(Matrix4d m1, Matrix4d m2) Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.final voidmulTransposeRight(Matrix4d m1, Matrix4d m2) Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.final voidnegate()Negates the value of this matrix: this = -this.final voidSets the value of this matrix equal to the negation of of the Matrix4d parameter.final voidrotX(double angle) Sets the value of this matrix to a counter-clockwise rotation about the x axis.final voidrotY(double angle) Sets the value of this matrix to a counter-clockwise rotation about the y axis.final voidrotZ(double angle) Sets the value of this matrix to a counter-clockwise rotation about the z axis.final voidset(double scale) Sets the value of this matrix to a scale matrix with the passed scale amount.final voidset(double[] m) Sets the values in this Matrix4d equal to the row-major array parameter (ie, the first four elements of the array will be copied into the first row of this matrix, etc.).final voidSets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.final voidset(AxisAngle4d a1) Sets the value of this matrix to the matrix conversion of the double precision axis and angle argument.final voidset(AxisAngle4f a1) Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.final voidSets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).final voidSets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor.final voidSets the rotational component (upper 3x3) of this matrix to the matrix values in the single precision Matrix3f argument; the other elements of this matrix are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).final voidSets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor.final voidSets the value of this matrix to a copy of the passed matrix m1.final voidSets the value of this matrix to a copy of the passed matrix m1.final voidSets the value of this matrix to the matrix conversion of the (double precision) quaternion argument.final voidSets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.final voidSets the value of this matrix to the matrix conversion of the single precision quaternion argument.final voidSets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.final voidSets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.final voidSets the value of this matrix to a translate matrix by the passed translation value.final voidSets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.final voidsetColumn(int column, double[] v) Sets the specified column of this matrix4d to the four values provided.final voidsetColumn(int column, double x, double y, double z, double w) Sets the specified column of this matrix4d to the four values provided.final voidSets the specified column of this matrix4d to the vector provided.final voidsetElement(int row, int column, double value) Sets the specified element of this matrix4f to the value provided.final voidSets this Matrix4d to identity.final voidsetM00(double m00) Set the first matrix element in the first row.final voidsetM01(double m01) Set the second matrix element in the first row.final voidsetM02(double m02) Set the third matrix element in the first row.final voidsetM03(double m03) Set the fourth element of the first row.final voidsetM10(double m10) Set first matrix element in the second row.final voidsetM11(double m11) Set the second matrix element in the second row.final voidsetM12(double m12) Set the third matrix element in the second row.final voidsetM13(double m13) Set the fourth element of the second row.final voidsetM20(double m20) Set the first matrix element in the third row.final voidsetM21(double m21) Set the second matrix element in the third row.final voidsetM22(double m22) Set the third matrix element in the third row.final voidsetM23(double m23) Set the fourth element of the third row.final voidsetM30(double m30) Set the first element of the fourth row.final voidsetM31(double m31) Set the second element of the fourth row.final voidsetM32(double m32) Set the third element of the fourth row.final voidsetM33(double m33) Set the fourth element of the fourth row.final voidSets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the axis-angle argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the axis-angle, and then the scale is reapplied to the rotational components.final voidsetRotation(Matrix3d m1) Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the passed rotation components, and then the scale is reapplied to the rotational components.final voidsetRotation(Matrix3f m1) Sets the rotational component (upper 3x3) of this matrix to the matrix values in the single precision Matrix3f argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the passed rotation components, and then the scale is reapplied to the rotational components.final voidsetRotation(Quat4d q1) Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the quaternion argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the quaternion, and then the scale is reapplied to the rotational components.final voidsetRotation(Quat4f q1) Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the quaternion argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the quaternion, and then the scale is reapplied to the rotational components.final voidReplaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.final voidReplaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.final voidsetRow(int row, double[] v) Sets the specified row of this matrix4d to the four values provided.final voidsetRow(int row, double x, double y, double z, double w) Sets the specified row of this matrix4d to the four values provided.final voidSets the specified row of this matrix4d to the Vector provided.final voidsetScale(double scale) Sets the scale component of the current matrix by factoring out the current scale (by doing an SVD) from the rotational component and multiplying by the new scale.final voidsetTranslation(Vector3d trans) Modifies the translational components of this matrix to the values of the Vector3d argument; the other values of this matrix are not modified.final voidsetZero()Sets this matrix to all zeros.final voidSets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).final voidSets the value of this matrix to the matrix difference of matrices m1 and m2.toString()Returns a string that contains the values of this Matrix4d.final voidTransforms the point parameter with this Matrix4d and places the result back into point.final voidTransforms the point parameter with this Matrix4d and places the result into pointOut.final voidTransforms the point parameter with this Matrix4d and places the result back into point.final voidTransforms the point parameter with this Matrix4d and places the result into pointOut.final voidTransform the vector vec using this Matrix4d and place the result back into vec.final voidTransform the vector vec using this Matrix4d and place the result into vecOut.final voidTransform the vector vec using this Transform and place the result back into vec.final voidTransform the vector vec using this Matrix4d and place the result into vecOut.final voidTransforms the normal parameter by this transform and places the value back into normal.final voidTransforms the normal parameter by this Matrix4d and places the value into normalOut.final voidTransforms the normal parameter by this transform and places the value back into normal.final voidTransforms the normal parameter by this Matrix4d and places the value into normalOut.final voidSets the value of this matrix to its transpose.final voidSets the value of this matrix to the transpose of the argument matrix
-
Field Details
-
m00
public double m00The first element of the first row. -
m01
public double m01The second element of the first row. -
m02
public double m02The third element of the first row. -
m03
public double m03The fourth element of the first row. -
m10
public double m10The first element of the second row. -
m11
public double m11The second element of the second row. -
m12
public double m12The third element of the second row. -
m13
public double m13The fourth element of the second row. -
m20
public double m20The first element of the third row. -
m21
public double m21The second element of the third row. -
m22
public double m22The third element of the third row. -
m23
public double m23The fourth element of the third row. -
m30
public double m30The first element of the fourth row. -
m31
public double m31The second element of the fourth row. -
m32
public double m32The third element of the fourth row. -
m33
public double m33The fourth element of the fourth row.
-
-
Constructor Details
-
Matrix4d
public Matrix4d(double m00, double m01, double m02, double m03, double m10, double m11, double m12, double m13, double m20, double m21, double m22, double m23, double m30, double m31, double m32, double m33) Constructs and initializes a Matrix4d from the specified 16 values.- Parameters:
m00- the [0][0] elementm01- the [0][1] elementm02- the [0][2] elementm03- the [0][3] elementm10- the [1][0] elementm11- the [1][1] elementm12- the [1][2] elementm13- the [1][3] elementm20- the [2][0] elementm21- the [2][1] elementm22- the [2][2] elementm23- the [2][3] elementm30- the [3][0] elementm31- the [3][1] elementm32- the [3][2] elementm33- the [3][3] element
-
Matrix4d
public Matrix4d(double[] v) Constructs and initializes a Matrix4d from the specified 16 element array. this.m00 =v[0], this.m01=v[1], etc.- Parameters:
v- the array of length 16 containing in order
-
Matrix4d
Constructs and initializes a Matrix4d from the quaternion, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components.- Parameters:
q1- the quaternion value representing the rotational componentt1- the translational component of the matrixs- the scale value applied to the rotational components
-
Matrix4d
Constructs and initializes a Matrix4d from the quaternion, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components.- Parameters:
q1- the quaternion value representing the rotational componentt1- the translational component of the matrixs- the scale value applied to the rotational components
-
Matrix4d
Constructs a new matrix with the same values as the Matrix4d parameter.- Parameters:
m1- the source matrix
-
Matrix4d
Constructs a new matrix with the same values as the Matrix4f parameter.- Parameters:
m1- the source matrix
-
Matrix4d
Constructs and initializes a Matrix4d from the rotation matrix, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.- Parameters:
m1- the rotation matrix representing the rotational componentst1- the translational components of the matrixs- the scale value applied to the rotational components
-
Matrix4d
Constructs and initializes a Matrix4f from the rotation matrix, translation, and scale values; the scale is applied only to the rotational components of the matrix (upper 3x3) and not to the translational components of the matrix.- Parameters:
m1- the rotation matrix representing the rotational componentst1- the translational components of the matrixs- the scale value applied to the rotational components
-
Matrix4d
public Matrix4d()Constructs and initializes a Matrix4d to all zeros.
-
-
Method Details
-
toString
-
setIdentity
public final void setIdentity()Sets this Matrix4d to identity. -
setElement
public final void setElement(int row, int column, double value) Sets the specified element of this matrix4f to the value provided.- Parameters:
row- the row number to be modified (zero indexed)column- the column number to be modified (zero indexed)value- the new value
-
getElement
public final double getElement(int row, int column) Retrieves the value at the specified row and column of this matrix.- Parameters:
row- the row number to be retrieved (zero indexed)column- the column number to be retrieved (zero indexed)- Returns:
- the value at the indexed element
-
getRow
Copies the matrix values in the specified row into the vector parameter.- Parameters:
row- the matrix rowv- the vector into which the matrix row values will be copied
-
getRow
public final void getRow(int row, double[] v) Copies the matrix values in the specified row into the array parameter.- Parameters:
row- the matrix rowv- the array into which the matrix row values will be copied
-
getColumn
Copies the matrix values in the specified column into the vector parameter.- Parameters:
column- the matrix columnv- the vector into which the matrix column values will be copied
-
getColumn
public final void getColumn(int column, double[] v) Copies the matrix values in the specified column into the array parameter.- Parameters:
column- the matrix columnv- the array into which the matrix column values will be copied
-
get
Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3d parameter.- Parameters:
m1- the matrix into which the rotational component is placed
-
get
Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3f parameter.- Parameters:
m1- the matrix into which the rotational component is placed
-
get
Performs an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale. None of the matrix values are modified.- Parameters:
m1- the normalized matrix representing the rotationt1- the translation component- Returns:
- the scale component of this transform
-
get
Performs an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale. None of the matrix values are modified.- Parameters:
m1- the normalized matrix representing the rotationt1- the translation component- Returns:
- the scale component of this transform
-
get
Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Quat4f parameter.- Parameters:
q1- quaternion into which the rotation component is placed
-
get
Performs an SVD normalization of q1 matrix in order to acquire the normalized rotational component; the values are placed into the Quat4d parameter.- Parameters:
q1- the quaternion into which the rotation component is placed
-
get
Retrieves the translational components of this matrix.- Parameters:
trans- the vector that will receive the translational component
-
getRotationScale
Gets the upper 3x3 values of this matrix and places them into the matrix m1.- Parameters:
m1- the matrix that will hold the values
-
getRotationScale
Gets the upper 3x3 values of this matrix and places them into the matrix m1.- Parameters:
m1- the matrix that will hold the values
-
getScale
public final double getScale()Performs an SVD normalization of this matrix to calculate and return the uniform scale factor. If the matrix has non-uniform scale factors, the largest of the x, y, and z scale factors will be returned. This matrix is not modified.- Returns:
- the scale factor of this matrix
-
setRotationScale
Replaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.- Parameters:
m1- the matrix that will be the new upper 3x3
-
setRotationScale
Replaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.- Parameters:
m1- the matrix that will be the new upper 3x3
-
setScale
public final void setScale(double scale) Sets the scale component of the current matrix by factoring out the current scale (by doing an SVD) from the rotational component and multiplying by the new scale.- Parameters:
scale- the new scale amount
-
setRow
public final void setRow(int row, double x, double y, double z, double w) Sets the specified row of this matrix4d to the four values provided.- Parameters:
row- the row number to be modified (zero indexed)x- the first column elementy- the second column elementz- the third column elementw- the fourth column element
-
setRow
Sets the specified row of this matrix4d to the Vector provided.- Parameters:
row- the row number to be modified (zero indexed)v- the replacement row
-
setRow
public final void setRow(int row, double[] v) Sets the specified row of this matrix4d to the four values provided.- Parameters:
row- the row number to be modified (zero indexed)v- the replacement row
-
setColumn
public final void setColumn(int column, double x, double y, double z, double w) Sets the specified column of this matrix4d to the four values provided.- Parameters:
column- the column number to be modified (zero indexed)x- the first row elementy- the second row elementz- the third row elementw- the fourth row element
-
setColumn
Sets the specified column of this matrix4d to the vector provided.- Parameters:
column- the column number to be modified (zero indexed)v- the replacement column
-
setColumn
public final void setColumn(int column, double[] v) Sets the specified column of this matrix4d to the four values provided.- Parameters:
column- the column number to be modified (zero indexed)v- the replacement column
-
add
public final void add(double scalar) Adds a scalar to each component of this matrix.- Parameters:
scalar- the scalar adder
-
add
Adds a scalar to each component of the matrix m1 and places the result into this. Matrix m1 is not modified.- Parameters:
scalar- the scalar adderm1- the original matrix values
-
add
-
add
Sets the value of this matrix to sum of itself and matrix m1.- Parameters:
m1- the other matrix
-
sub
-
sub
Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).- Parameters:
m1- the other matrix
-
transpose
public final void transpose()Sets the value of this matrix to its transpose. -
transpose
Sets the value of this matrix to the transpose of the argument matrix- Parameters:
m1- the matrix to be transposed
-
set
public final void set(double[] m) Sets the values in this Matrix4d equal to the row-major array parameter (ie, the first four elements of the array will be copied into the first row of this matrix, etc.).- Parameters:
m- the double precision array of length 16
-
set
Sets the rotational component (upper 3x3) of this matrix to the matrix values in the single precision Matrix3f argument; the other elements of this matrix are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).- Parameters:
m1- the double precision 3x3 matrix
-
set
Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are initialized as if this were an identity matrix (i.e., affine matrix with no translational component).- Parameters:
m1- the double precision 3x3 matrix
-
set
Sets the value of this matrix to the matrix conversion of the (double precision) quaternion argument.- Parameters:
q1- the quaternion to be converted
-
set
Sets the value of this matrix to the matrix conversion of the double precision axis and angle argument.- Parameters:
a1- the axis and angle to be converted
-
set
Sets the value of this matrix to the matrix conversion of the single precision quaternion argument.- Parameters:
q1- the quaternion to be converted
-
set
Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.- Parameters:
a1- the axis and angle to be converted
-
set
-
set
-
set
-
set
Sets the value of this matrix to a copy of the passed matrix m1.- Parameters:
m1- the matrix4f
-
set
Sets the value of this matrix to a copy of the passed matrix m1.- Parameters:
m1- the matrix to be copied
-
invert
Sets the value of this matrix to the matrix inverse of the passed (user declared) matrix m1.- Parameters:
m1- the matrix to be inverted
-
invert
public final void invert()Inverts this matrix in place. -
determinant
public final double determinant()Computes the determinant of this matrix.- Returns:
- the determinant of the matrix
-
set
public final void set(double scale) Sets the value of this matrix to a scale matrix with the passed scale amount.- Parameters:
scale- the scale factor for the matrix
-
set
Sets the value of this matrix to a translate matrix by the passed translation value.- Parameters:
v1- the translation amount
-
set
Sets the value of this transform to a scale and translation matrix; the scale is not applied to the translation and all of the matrix values are modified.- Parameters:
scale- the scale factor for the matrixv1- the translation amount
-
set
Sets the value of this transform to a scale and translation matrix; the translation is scaled by the scale factor and all of the matrix values are modified.- Parameters:
v1- the translation amountscale- the scale factor for the matrix
-
set
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor. The translation is not modified by the scale.- Parameters:
m1- the rotation componentt1- the translation componentscale- the scale component
-
set
Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor. The translation is not modified by the scale.- Parameters:
m1- the rotation componentt1- the translation componentscale- the scale component
-
setTranslation
Modifies the translational components of this matrix to the values of the Vector3d argument; the other values of this matrix are not modified.- Parameters:
trans- the translational component
-
rotX
public final void rotX(double angle) Sets the value of this matrix to a counter-clockwise rotation about the x axis.- Parameters:
angle- the angle to rotate about the X axis in radians
-
rotY
public final void rotY(double angle) Sets the value of this matrix to a counter-clockwise rotation about the y axis.- Parameters:
angle- the angle to rotate about the Y axis in radians
-
rotZ
public final void rotZ(double angle) Sets the value of this matrix to a counter-clockwise rotation about the z axis.- Parameters:
angle- the angle to rotate about the Z axis in radians
-
mul
public final void mul(double scalar) Multiplies each element of this matrix by a scalar.- Parameters:
scalar- the scalar multiplier.
-
mul
Multiplies each element of matrix m1 by a scalar and places the result into this. Matrix m1 is not modified.- Parameters:
scalar- the scalar multiplierm1- the original matrix
-
mul
Sets the value of this matrix to the result of multiplying itself with matrix m1.- Parameters:
m1- the other matrix
-
mul
-
mulTransposeBoth
-
mulTransposeRight
-
mulTransposeLeft
-
equals
Returns true if all of the data members of Matrix4d m1 are equal to the corresponding data members in this Matrix4d.- Parameters:
m1- the matrix with which the comparison is made- Returns:
- true or false
-
equals
-
epsilonEquals
Deprecated.Use epsilonEquals(Matrix4d,double) instead -
epsilonEquals
Returns true if the L-infinite distance between this matrix and matrix m1 is less than or equal to the epsilon parameter, otherwise returns false. The L-infinite distance is equal to MAX[i=0,1,2,3 ; j=0,1,2,3 ; abs(this.m(i,j) - m1.m(i,j)]- Parameters:
m1- the matrix to be compared to this matrixepsilon- the threshold value
-
hashCode
public int hashCode()Returns a hash code value based on the data values in this object. Two different Matrix4d objects with identical data values (i.e., Matrix4d.equals returns true) will return the same hash code value. Two objects with different data members may return the same hash value, although this is not likely. -
transform
-
transform
Transform the vector vec using this Matrix4d and place the result back into vec.- Parameters:
vec- the double precision vector to be transformed
-
transform
-
transform
Transform the vector vec using this Transform and place the result back into vec.- Parameters:
vec- the single precision vector to be transformed
-
transform
Transforms the point parameter with this Matrix4d and places the result into pointOut. The fourth element of the point input parameter is assumed to be one.- Parameters:
point- the input point to be transformed.pointOut- the transformed point
-
transform
Transforms the point parameter with this Matrix4d and places the result back into point. The fourth element of the point input parameter is assumed to be one.- Parameters:
point- the input point to be transformed.
-
transform
Transforms the point parameter with this Matrix4d and places the result into pointOut. The fourth element of the point input parameter is assumed to be one.- Parameters:
point- the input point to be transformed.pointOut- the transformed point
-
transform
Transforms the point parameter with this Matrix4d and places the result back into point. The fourth element of the point input parameter is assumed to be one.- Parameters:
point- the input point to be transformed.
-
transform
-
transform
Transforms the normal parameter by this transform and places the value back into normal. The fourth element of the normal is assumed to be zero.- Parameters:
normal- the input normal to be transformed.
-
transform
-
transform
Transforms the normal parameter by this transform and places the value back into normal. The fourth element of the normal is assumed to be zero.- Parameters:
normal- the input normal to be transformed.
-
setRotation
Sets the rotational component (upper 3x3) of this matrix to the matrix values in the double precision Matrix3d argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the passed rotation components, and then the scale is reapplied to the rotational components.- Parameters:
m1- double precision 3x3 matrix
-
setRotation
Sets the rotational component (upper 3x3) of this matrix to the matrix values in the single precision Matrix3f argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the passed rotation components, and then the scale is reapplied to the rotational components.- Parameters:
m1- single precision 3x3 matrix
-
setRotation
Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the quaternion argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the quaternion, and then the scale is reapplied to the rotational components.- Parameters:
q1- the quaternion that specifies the rotation
-
setRotation
Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the quaternion argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the quaternion, and then the scale is reapplied to the rotational components.- Parameters:
q1- the quaternion that specifies the rotation
-
setRotation
Sets the rotational component (upper 3x3) of this matrix to the matrix equivalent values of the axis-angle argument; the other elements of this matrix are unchanged; a singular value decomposition is performed on this object's upper 3x3 matrix to factor out the scale, then this object's upper 3x3 matrix components are replaced by the matrix equivalent of the axis-angle, and then the scale is reapplied to the rotational components.- Parameters:
a1- the axis-angle to be converted (x, y, z, angle)
-
setZero
public final void setZero()Sets this matrix to all zeros. -
negate
public final void negate()Negates the value of this matrix: this = -this. -
negate
Sets the value of this matrix equal to the negation of of the Matrix4d parameter.- Parameters:
m1- the source matrix
-
clone
Creates a new object of the same class as this object.- Overrides:
clonein classObject- Returns:
- a clone of this instance.
- Throws:
OutOfMemoryError- if there is not enough memory.- Since:
- vecmath 1.3
- See Also:
-
getM00
public final double getM00()Get the first matrix element in the first row.- Returns:
- Returns the m00.
- Since:
- vecmath 1.5
-
setM00
public final void setM00(double m00) Set the first matrix element in the first row.- Parameters:
m00- The m00 to set.- Since:
- vecmath 1.5
-
getM01
public final double getM01()Get the second matrix element in the first row.- Returns:
- Returns the m01.
- Since:
- vecmath 1.5
-
setM01
public final void setM01(double m01) Set the second matrix element in the first row.- Parameters:
m01- The m01 to set.- Since:
- vecmath 1.5
-
getM02
public final double getM02()Get the third matrix element in the first row.- Returns:
- Returns the m02.
- Since:
- vecmath 1.5
-
setM02
public final void setM02(double m02) Set the third matrix element in the first row.- Parameters:
m02- The m02 to set.- Since:
- vecmath 1.5
-
getM10
public final double getM10()Get first matrix element in the second row.- Returns:
- Returns the m10.
- Since:
- vecmath 1.5
-
setM10
public final void setM10(double m10) Set first matrix element in the second row.- Parameters:
m10- The m10 to set.- Since:
- vecmath 1.5
-
getM11
public final double getM11()Get second matrix element in the second row.- Returns:
- Returns the m11.
- Since:
- vecmath 1.5
-
setM11
public final void setM11(double m11) Set the second matrix element in the second row.- Parameters:
m11- The m11 to set.- Since:
- vecmath 1.5
-
getM12
public final double getM12()Get the third matrix element in the second row.- Returns:
- Returns the m12.
- Since:
- vecmath 1.5
-
setM12
public final void setM12(double m12) Set the third matrix element in the second row.- Parameters:
m12- The m12 to set.- Since:
- vecmath 1.5
-
getM20
public final double getM20()Get the first matrix element in the third row.- Returns:
- Returns the m20.
- Since:
- vecmath 1.5
-
setM20
public final void setM20(double m20) Set the first matrix element in the third row.- Parameters:
m20- The m20 to set.- Since:
- vecmath 1.5
-
getM21
public final double getM21()Get the second matrix element in the third row.- Returns:
- Returns the m21.
- Since:
- vecmath 1.5
-
setM21
public final void setM21(double m21) Set the second matrix element in the third row.- Parameters:
m21- The m21 to set.- Since:
- vecmath 1.5
-
getM22
public final double getM22()Get the third matrix element in the third row.- Returns:
- Returns the m22.
- Since:
- vecmath 1.5
-
setM22
public final void setM22(double m22) Set the third matrix element in the third row.- Parameters:
m22- The m22 to set.- Since:
- vecmath 1.5
-
getM03
public final double getM03()Get the fourth element of the first row.- Returns:
- Returns the m03.
- Since:
- vecmath 1.5
-
setM03
public final void setM03(double m03) Set the fourth element of the first row.- Parameters:
m03- The m03 to set.- Since:
- vecmath 1.5
-
getM13
public final double getM13()Get the fourth element of the second row.- Returns:
- Returns the m13.
- Since:
- vecmath 1.5
-
setM13
public final void setM13(double m13) Set the fourth element of the second row.- Parameters:
m13- The m13 to set.- Since:
- vecmath 1.5
-
getM23
public final double getM23()Get the fourth element of the third row.- Returns:
- Returns the m23.
- Since:
- vecmath 1.5
-
setM23
public final void setM23(double m23) Set the fourth element of the third row.- Parameters:
m23- The m23 to set.- Since:
- vecmath 1.5
-
getM30
public final double getM30()Get the first element of the fourth row.- Returns:
- Returns the m30.
- Since:
- vecmath 1.5
-
setM30
public final void setM30(double m30) Set the first element of the fourth row.- Parameters:
m30- The m30 to set.- Since:
- vecmath 1.5
-
getM31
public final double getM31()Get the second element of the fourth row.- Returns:
- Returns the m31.
- Since:
- vecmath 1.5
-
setM31
public final void setM31(double m31) Set the second element of the fourth row.- Parameters:
m31- The m31 to set.- Since:
- vecmath 1.5
-
getM32
public final double getM32()Get the third element of the fourth row.- Returns:
- Returns the m32.
- Since:
- vecmath 1.5
-
setM32
public final void setM32(double m32) Set the third element of the fourth row.- Parameters:
m32- The m32 to set.- Since:
- vecmath 1.5
-
getM33
public final double getM33()Get the fourth element of the fourth row.- Returns:
- Returns the m33.
- Since:
- vecmath 1.5
-
setM33
public final void setM33(double m33) Set the fourth element of the fourth row.- Parameters:
m33- The m33 to set.- Since:
- vecmath 1.5
-