Top Description Fields Constructors Methods
javax.vecmath

public Class Matrix4d

extends Object
implements Serializable, Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable, java.io.Serializable
Imports
java.lang.Math

A double precision floating point 4 by 4 matrix. Primarily to support 3D rotations.

Field Summary

Modifier and TypeField and Description
private static final double
public double
m00

The first element of the first row.

public double
m01

The second element of the first row.

public double
m02

The third element of the first row.

public double
m03

The fourth element of the first row.

public double
m10

The first element of the second row.

public double
m11

The second element of the second row.

public double
m12

The third element of the second row.

public double
m13

The fourth element of the second row.

public double
m20

The first element of the third row.

public double
m21

The second element of the third row.

public double
m22

The third element of the third row.

public double
m23

The fourth element of the third row.

public double
m30

The first element of the fourth row.

public double
m31

The second element of the fourth row.

public double
m32

The third element of the fourth row.

public double
m33

The fourth element of the fourth row.

pack-priv static final long

Constructor Summary

AccessConstructor and Description
public
Matrix4d(double
the [0][0] element
m00
,
double
the [0][1] element
m01
,
double
the [0][2] element
m02
,
double
the [0][3] element
m03
,
double
the [1][0] element
m10
,
double
the [1][1] element
m11
,
double
the [1][2] element
m12
,
double
the [1][3] element
m13
,
double
the [2][0] element
m20
,
double
the [2][1] element
m21
,
double
the [2][2] element
m22
,
double
the [2][3] element
m23
,
double
the [3][0] element
m30
,
double
the [3][1] element
m31
,
double
the [3][2] element
m32
,
double
the [3][3] element
m33
)

Constructs and initializes a Matrix4d from the specified 16 values.

public
Matrix4d(double[]
the array of length 16 containing in order
v
)

Constructs and initializes a Matrix4d from the specified 16 element array.

public
Matrix4d(Quat4d
the quaternion value representing the rotational component
q1
,
Vector3d
the translational component of the matrix
t1
,
double
the scale value applied to the rotational components
s
)

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.

public
Matrix4d(Quat4f
the quaternion value representing the rotational component
q1
,
Vector3d
the translational component of the matrix
t1
,
double
the scale value applied to the rotational components
s
)

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.

public
Matrix4d(Matrix4d
the source matrix
m1
)

Constructs a new matrix with the same values as the Matrix4d parameter.

public
Matrix4d(Matrix4f
the source matrix
m1
)

Constructs a new matrix with the same values as the Matrix4f parameter.

public
Matrix4d(Matrix3f
the rotation matrix representing the rotational components
m1
,
Vector3d
the translational components of the matrix
t1
,
double
the scale value applied to the rotational components
s
)

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.

public
Matrix4d(Matrix3d
the rotation matrix representing the rotational components
m1
,
Vector3d
the translational components of the matrix
t1
,
double
the scale value applied to the rotational components
s
)

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.

public
Matrix4d()

Constructs and initializes a Matrix4d to all zeros.

Method Summary

Modifier and TypeMethod and Description
public final void
add(double
the scalar adder
scalar
)

Adds a scalar to each component of this matrix.

public final void
add(double
the scalar adder
scalar
,
Matrix4d
the original matrix values
m1
)

Adds a scalar to each component of the matrix m1 and places the result into this.

public final void
add(Matrix4d
the first matrix
m1
,
Matrix4d
the second matrix
m2
)

Sets the value of this matrix to the matrix sum of matrices m1 and m2.

public final void
add(Matrix4d
the other matrix
m1
)

Sets the value of this matrix to sum of itself and matrix m1.

public Object

Returns:

a clone of this instance.
clone
()

Overrides java.lang.Object.clone.

Creates a new object of the same class as this object.
public final double

Returns:

the determinant of the matrix
determinant
()

Computes the determinant of this matrix.

public boolean
epsilonEquals(Matrix4d m1, float epsilon)

Deprecated Use epsilonEquals(Matrix4d,double) instead
public boolean
epsilonEquals(Matrix4d
the matrix to be compared to this matrix
m1
,
double
the threshold value
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.

public boolean

Returns:

true or false
equals
(Matrix4d
the matrix with which the comparison is made
m1
)

Returns true if all of the data members of Matrix4d m1 are equal to the corresponding data members in this Matrix4d.

public boolean

Returns:

true or false
equals
(Object
the matrix with which the comparison is made
t1
)

Overrides java.lang.Object.equals.

Returns 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.
public final void
get(Matrix3d
the matrix into which the rotational component is placed
m1
)

Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3d parameter.

public final void
get(Matrix3f
the matrix into which the rotational component is placed
m1
)

Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Matrix3f parameter.

public final double

Returns:

the scale component of this transform
get
(Matrix3d
the normalized matrix representing the rotation
m1
,
Vector3d
the translation component
t1
)

Performs an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale.

public final double

Returns:

the scale component of this transform
get
(Matrix3f
the normalized matrix representing the rotation
m1
,
Vector3d
the translation component
t1
)

Performs an SVD normalization of this matrix to calculate the rotation as a 3x3 matrix, the translation, and the scale.

public final void
get(Quat4f
quaternion into which the rotation component is placed
q1
)

Performs an SVD normalization of this matrix in order to acquire the normalized rotational component; the values are placed into the Quat4f parameter.

public final void
get(Quat4d
the quaternion into which the rotation component is placed
q1
)

Performs an SVD normalization of q1 matrix in order to acquire the normalized rotational component; the values are placed into the Quat4d parameter.

public final void
get(Vector3d
the vector that will receive the translational component
trans
)

Retrieves the translational components of this matrix.

public final void
getColumn(int
the matrix column
column
,
Vector4d
the vector into which the matrix column values will be copied
v
)

Copies the matrix values in the specified column into the vector parameter.

public final void
getColumn(int
the matrix column
column
,
double[]
the array into which the matrix column values will be copied
v
)

Copies the matrix values in the specified column into the array parameter.

public final double

Returns:

the value at the indexed element
getElement
(int
the row number to be retrieved (zero indexed)
row
,
int
the column number to be retrieved (zero indexed)
column
)

Retrieves the value at the specified row and column of this matrix.

public final double

Returns:

Returns the m00.
getM00
()

Get the first matrix element in the first row.

public final double

Returns:

Returns the m01.
getM01
()

Get the second matrix element in the first row.

public final double

Returns:

Returns the m02.
getM02
()

Get the third matrix element in the first row.

public final double

Returns:

Returns the m03.
getM03
()

Get the fourth element of the first row.

public final double

Returns:

Returns the m10.
getM10
()

Get first matrix element in the second row.

public final double

Returns:

Returns the m11.
getM11
()

Get second matrix element in the second row.

public final double

Returns:

Returns the m12.
getM12
()

Get the third matrix element in the second row.

public final double

Returns:

Returns the m13.
getM13
()

Get the fourth element of the second row.

public final double

Returns:

Returns the m20.
getM20
()

Get the first matrix element in the third row.

public final double

Returns:

Returns the m21.
getM21
()

Get the second matrix element in the third row.

public final double

Returns:

Returns the m22.
getM22
()

Get the third matrix element in the third row.

public final double

Returns:

Returns the m23.
getM23
()

Get the fourth element of the third row.

public final double

Returns:

Returns the m30.
getM30
()

Get the first element of the fourth row.

public final double

Returns:

Returns the m31.
getM31
()

Get the second element of the fourth row.

public final double

Returns:

Returns the m32.
getM32
()

Get the third element of the fourth row.

public final double

Returns:

Returns the m33.
getM33
()

Get the fourth element of the fourth row.

public final void
getRotationScale(Matrix3f
the matrix that will hold the values
m1
)

Gets the upper 3x3 values of this matrix and places them into the matrix m1.

public final void
getRotationScale(Matrix3d
the matrix that will hold the values
m1
)

Gets the upper 3x3 values of this matrix and places them into the matrix m1.

public final void
getRow(int
the matrix row
row
,
Vector4d
the vector into which the matrix row values will be copied
v
)

Copies the matrix values in the specified row into the vector parameter.

public final void
getRow(int
the matrix row
row
,
double[]
the array into which the matrix row values will be copied
v
)

Copies the matrix values in the specified row into the array parameter.

public final double

Returns:

the scale factor of this matrix
getScale
()

Performs an SVD normalization of this matrix to calculate and return the uniform scale factor.

private final void
getScaleRotate(double[] scales, double[] rots)

public int

Returns:

the integer hash code value
hashCode
()

Overrides java.lang.Object.hashCode.

Returns a hash code value based on the data values in this object.
public final void
invert(Matrix4d
the matrix to be inverted
m1
)

Sets the value of this matrix to the matrix inverse of the passed (user declared) matrix m1.

public final void
invert()

Inverts this matrix in place.

pack-priv final void
invertGeneral(Matrix4d m1)

General invert routine.

pack-priv static void
luBacksubstitution(double[] matrix1, int[] row_perm, double[] matrix2)

Solves a set of linear equations.

pack-priv static boolean

Returns:

true if the matrix is nonsingular, or false otherwise.
luDecomposition
(double[] matrix0, int[] row_perm)

Given a 4x4 array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself.

public final void
mul(double
the scalar multiplier.
scalar
)

Multiplies each element of this matrix by a scalar.

public final void
mul(double
the scalar multiplier
scalar
,
Matrix4d
the original matrix
m1
)

Multiplies each element of matrix m1 by a scalar and places the result into this.

public final void
mul(Matrix4d
the other matrix
m1
)

Sets the value of this matrix to the result of multiplying itself with matrix m1.

public final void
mul(Matrix4d
the first matrix
m1
,
Matrix4d
the second matrix
m2
)

Sets the value of this matrix to the result of multiplying the two argument matrices together.

public final void
mulTransposeBoth(Matrix4d
the matrix on the left hand side of the multiplication
m1
,
Matrix4d
the matrix on the right hand side of the multiplication
m2
)

Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.

public final void
mulTransposeLeft(Matrix4d
the matrix on the left hand side of the multiplication
m1
,
Matrix4d
the matrix on the right hand side of the multiplication
m2
)

Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.

public final void
mulTransposeRight(Matrix4d
the matrix on the left hand side of the multiplication
m1
,
Matrix4d
the matrix on the right hand side of the multiplication
m2
)

Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.

public final void
negate()

Negates the value of this matrix: this = -this.

public final void
negate(Matrix4d
the source matrix
m1
)

Sets the value of this matrix equal to the negation of of the Matrix4d parameter.

public final void
rotX(double
the angle to rotate about the X axis in radians
angle
)

Sets the value of this matrix to a counter-clockwise rotation about the x axis.

public final void
rotY(double
the angle to rotate about the Y axis in radians
angle
)

Sets the value of this matrix to a counter-clockwise rotation about the y axis.

public final void
rotZ(double
the angle to rotate about the Z axis in radians
angle
)

Sets the value of this matrix to a counter-clockwise rotation about the z axis.

public final void
set(double[]
the double precision array of length 16
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.).

public final void
set(Matrix3f
the double precision 3x3 matrix
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 initialized as if this were an identity matrix (i.e., affine matrix with no translational component).

public final void
set(Matrix3d
the double precision 3x3 matrix
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 initialized as if this were an identity matrix (i.e., affine matrix with no translational component).

public final void
set(Quat4d
the quaternion to be converted
q1
)

Sets the value of this matrix to the matrix conversion of the (double precision) quaternion argument.

public final void
set(AxisAngle4d
the axis and angle to be converted
a1
)

Sets the value of this matrix to the matrix conversion of the double precision axis and angle argument.

public final void
set(Quat4f
the quaternion to be converted
q1
)

Sets the value of this matrix to the matrix conversion of the single precision quaternion argument.

public final void
set(AxisAngle4f
the axis and angle to be converted
a1
)

Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.

public final void
set(Quat4d
the rotation expressed as a quaternion
q1
,
Vector3d
the translation
t1
,
double
the scale value
s
)

Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.

public final void
set(Quat4f
the rotation expressed as a quaternion
q1
,
Vector3d
the translation
t1
,
double
the scale value
s
)

Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.

public final void
set(Quat4f
the rotation expressed as a quaternion
q1
,
Vector3f
the translation
t1
,
float
the scale value
s
)

Sets the value of this matrix from the rotation expressed by the quaternion q1, the translation t1, and the scale s.

public final void
set(Matrix4f
the matrix4f
m1
)

Sets the value of this matrix to a copy of the passed matrix m1.

public final void
set(Matrix4d
the matrix to be copied
m1
)

Sets the value of this matrix to a copy of the passed matrix m1.

public final void
set(double
the scale factor for the matrix
scale
)

Sets the value of this matrix to a scale matrix with the passed scale amount.

public final void
set(Vector3d
the translation amount
v1
)

Sets the value of this matrix to a translate matrix by the passed translation value.

public final void
set(double
the scale factor for the matrix
scale
,
Vector3d
the translation amount
v1
)

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.

public final void
set(Vector3d
the translation amount
v1
,
double
the scale factor for the matrix
scale
)

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.

public final void
set(Matrix3f
the rotation component
m1
,
Vector3f
the translation component
t1
,
float
the scale component
scale
)

Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor.

public final void
set(Matrix3d
the rotation component
m1
,
Vector3d
the translation component
t1
,
double
the scale component
scale
)

Sets the value of this matrix from the rotation expressed by the rotation matrix m1, the translation t1, and the scale factor.

public final void
setColumn(int
the column number to be modified (zero indexed)
column
,
double
the first row element
x
,
double
the second row element
y
,
double
the third row element
z
,
double
the fourth row element
w
)

Sets the specified column of this matrix4d to the four values provided.

public final void
setColumn(int
the column number to be modified (zero indexed)
column
,
Vector4d
the replacement column
v
)

Sets the specified column of this matrix4d to the vector provided.

public final void
setColumn(int
the column number to be modified (zero indexed)
column
,
double[]
the replacement column
v
)

Sets the specified column of this matrix4d to the four values provided.

public final void
setElement(int
the row number to be modified (zero indexed)
row
,
int
the column number to be modified (zero indexed)
column
,
double
the new value
value
)

Sets the specified element of this matrix4f to the value provided.

public final void
setIdentity()

Sets this Matrix4d to identity.

public final void
setM00(double
The m00 to set.
m00
)

Set the first matrix element in the first row.

public final void
setM01(double
The m01 to set.
m01
)

Set the second matrix element in the first row.

public final void
setM02(double
The m02 to set.
m02
)

Set the third matrix element in the first row.

public final void
setM03(double
The m03 to set.
m03
)

Set the fourth element of the first row.

public final void
setM10(double
The m10 to set.
m10
)

Set first matrix element in the second row.

public final void
setM11(double
The m11 to set.
m11
)

Set the second matrix element in the second row.

public final void
setM12(double
The m12 to set.
m12
)

Set the third matrix element in the second row.

public final void
setM13(double
The m13 to set.
m13
)

Set the fourth element of the second row.

public final void
setM20(double
The m20 to set.
m20
)

Set the first matrix element in the third row.

public final void
setM21(double
The m21 to set.
m21
)

Set the second matrix element in the third row.

public final void
setM22(double
The m22 to set.
m22
)

Set the third matrix element in the third row.

public final void
setM23(double
The m23 to set.
m23
)

Set the fourth element of the third row.

public final void
setM30(double
The m30 to set.
m30
)

Set the first element of the fourth row.

public final void
setM31(double
The m31 to set.
m31
)

Set the second element of the fourth row.

public final void
setM32(double
The m32 to set.
m32
)

Set the third element of the fourth row.

public final void
setM33(double
The m33 to set.
m33
)

Set the fourth element of the fourth row.

public final void
setRotation(Matrix3d
double precision 3x3 matrix
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.

public final void
setRotation(Matrix3f
single precision 3x3 matrix
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.

public final void
setRotation(Quat4f
the quaternion that specifies the rotation
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.

public final void
setRotation(Quat4d
the quaternion that specifies the rotation
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.

public final void
setRotation(AxisAngle4d
the axis-angle to be converted (x, y, z, angle)
a1
)

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.

public final void
setRotationScale(Matrix3d
the matrix that will be the new upper 3x3
m1
)

Replaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.

public final void
setRotationScale(Matrix3f
the matrix that will be the new upper 3x3
m1
)

Replaces the upper 3x3 matrix values of this matrix with the values in the matrix m1.

public final void
setRow(int
the row number to be modified (zero indexed)
row
,
double
the first column element
x
,
double
the second column element
y
,
double
the third column element
z
,
double
the fourth column element
w
)

Sets the specified row of this matrix4d to the four values provided.

public final void
setRow(int
the row number to be modified (zero indexed)
row
,
Vector4d
the replacement row
v
)

Sets the specified row of this matrix4d to the Vector provided.

public final void
setRow(int
the row number to be modified (zero indexed)
row
,
double[]
the replacement row
v
)

Sets the specified row of this matrix4d to the four values provided.

public final void
setScale(double
the new scale amount
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.

public final void
setTranslation(Vector3d
the translational component
trans
)

Modifies the translational components of this matrix to the values of the Vector3d argument; the other values of this matrix are not modified.

public final void
setZero()

Sets this matrix to all zeros.

public final void
sub(Matrix4d
the first matrix
m1
,
Matrix4d
the second matrix
m2
)

Sets the value of this matrix to the matrix difference of matrices m1 and m2.

public final void
sub(Matrix4d
the other matrix
m1
)

Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).

public String

Returns:

the String representation
toString
()

Overrides java.lang.Object.toString.

Returns a string that contains the values of this Matrix4d.
public final void
transform(Tuple4d
the double precision vector to be transformed
vec
,
Tuple4d
the vector into which the transformed values are placed
vecOut
)

Transform the vector vec using this Matrix4d and place the result into vecOut.

public final void
transform(Tuple4d
the double precision vector to be transformed
vec
)

Transform the vector vec using this Matrix4d and place the result back into vec.

public final void
transform(Tuple4f
the single precision vector to be transformed
vec
,
Tuple4f
the vector into which the transformed values are placed
vecOut
)

Transform the vector vec using this Matrix4d and place the result into vecOut.

public final void
transform(Tuple4f
the single precision vector to be transformed
vec
)

Transform the vector vec using this Transform and place the result back into vec.

public final void
transform(Point3d
the input point to be transformed.
point
,
Point3d
the transformed point
pointOut
)

Transforms the point parameter with this Matrix4d and places the result into pointOut.

public final void
transform(Point3d
the input point to be transformed.
point
)

Transforms the point parameter with this Matrix4d and places the result back into point.

public final void
transform(Point3f
the input point to be transformed.
point
,
Point3f
the transformed point
pointOut
)

Transforms the point parameter with this Matrix4d and places the result into pointOut.

public final void
transform(Point3f
the input point to be transformed.
point
)

Transforms the point parameter with this Matrix4d and places the result back into point.

public final void
transform(Vector3d
the input normal to be transformed.
normal
,
Vector3d
the transformed normal
normalOut
)

Transforms the normal parameter by this Matrix4d and places the value into normalOut.

public final void
transform(Vector3d
the input normal to be transformed.
normal
)

Transforms the normal parameter by this transform and places the value back into normal.

public final void
transform(Vector3f
the input normal to be transformed.
normal
,
Vector3f
the transformed normal
normalOut
)

Transforms the normal parameter by this Matrix4d and places the value into normalOut.

public final void
transform(Vector3f
the input normal to be transformed.
normal
)

Transforms the normal parameter by this transform and places the value back into normal.

public final void
transpose()

Sets the value of this matrix to its transpose.

public final void
transpose(Matrix4d
the matrix to be transposed
m1
)

Sets the value of this matrix to the transpose of the argument matrix

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait