Top Description Fields Constructors Methods
javax.vecmath

public Class Matrix3d

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 3 by 3 matrix. Primarily to support 3D rotations.

Field Summary

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

The first matrix element in the first row.

public double
m01

The second matrix element in the first row.

public double
m02

The third matrix element in the first row.

public double
m10

The first matrix element in the second row.

public double
m11

The second matrix element in the second row.

public double
m12

The third matrix element in the second row.

public double
m20

The first matrix element in the third row.

public double
m21

The second matrix element in the third row.

public double
m22

The third matrix element in the third row.

pack-priv static final long
private static double
private static double
private static double
private static double
private static double
private static double

Constructor Summary

AccessConstructor and Description
public
Matrix3d(double
the [0][0] element
m00
,
double
the [0][1] element
m01
,
double
the [0][2] element
m02
,
double
the [1][0] element
m10
,
double
the [1][1] element
m11
,
double
the [1][2] element
m12
,
double
the [2][0] element
m20
,
double
the [2][1] element
m21
,
double
the [2][2] element
m22
)

Constructs and initializes a Matrix3d from the specified nine values.

public
Matrix3d(double[]
the array of length 9 containing in order
v
)

Constructs and initializes a Matrix3d from the specified nine- element array.

public
Matrix3d(Matrix3d
the source matrix
m1
)

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

public
Matrix3d(Matrix3f
the source matrix
m1
)

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

public
Matrix3d()

Constructs and initializes a Matrix3d 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
,
Matrix3d
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(Matrix3d
the first matrix
m1
,
Matrix3d
the second matrix
m2
)

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

public final void
add(Matrix3d
the other matrix
m1
)

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

private static final boolean
almostEqual(double a, double b)

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.
pack-priv static int
compute_2X2(double f, double g, double h, double[] single_values, double[] snl, double[] csl, double[] snr, double[] csr, int index)

pack-priv static int
compute_qr(double[] s, double[] e, double[] u, double[] v)

pack-priv static double
compute_rot(double f, double g, double[] sin, double[] cos, int index, int first)

pack-priv static double
compute_shift(double f, double g, double h)

pack-priv static void
compute_svd(double[] m, double[] outScale, double[] outRot)

pack-priv static double
d_sign(double a, double b)

public final double

Returns:

the determinant of the matrix
determinant
()

Computes the determinant of this matrix.

public boolean
epsilonEquals(Matrix3d
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
(Matrix3d
the matrix with which the comparison is made
m1
)

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

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 Matrix3d and all of the data members of t1 are equal to the corresponding data members in this Matrix3d.
public final void
getColumn(int
the matrix column
column
,
Vector3d
the vector into which the matrix row 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 row 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 the specified 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 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 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 void
getRow(int
the matrix row
row
,
Vector3d
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.

pack-priv final void
getScaleRotate(double[] scales, double[] rots)

perform SVD (if necessary to get rotational component

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(Matrix3d
the matrix to be inverted
m1
)

Sets the value of this matrix to the matrix inverse of the passed matrix m1.

public final void
invert()

Inverts this matrix in place.

private final void
invertGeneral(Matrix3d 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 3x3 array "matrix0", this function replaces it with the LU decomposition of a row-wise permutation of itself.

pack-priv static void
mat_mul(double[] m1, double[] m2, double[] m3)

pack-priv static double
max(double a, double b)

pack-priv static double
max3(double[] values)

pack-priv static double
min(double a, double b)

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
,
Matrix3d
the original matrix
m1
)

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

public final void
mul(Matrix3d
the other matrix
m1
)

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

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

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

public final void
mulNormalize(Matrix3d
the matrix on the right hand side of the multiplication
m1
)

Multiplies this matrix by matrix m1, does an SVD normalization of the result, and places the result back into this matrix this = SVDnorm(this*m1).

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

Multiplies matrix m1 by matrix m2, does an SVD normalization of the result, and places the result into this matrix this = SVDnorm(m1*m2).

public final void
mulTransposeBoth(Matrix3d
the matrix on the left hand side of the multiplication
m1
,
Matrix3d
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(Matrix3d
the matrix on the left hand side of the multiplication
m1
,
Matrix3d
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(Matrix3d
the matrix on the left hand side of the multiplication
m1
,
Matrix3d
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(Matrix3d
the source matrix
m1
)

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

public final void
normalize()

Performs singular value decomposition normalization of this matrix.

public final void
normalize(Matrix3d
Provides the matrix values to be normalized
m1
)

Perform singular value decomposition normalization of matrix m1 and place the normalized values into this.

public final void
normalizeCP()

Perform cross product normalization of this matrix.

public final void
normalizeCP(Matrix3d
Provides the matrix values to be normalized
m1
)

Perform cross product normalization of matrix m1 and place the normalized values into this.

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(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(Matrix3f
the matrix3d to be converted to double
m1
)

Sets the value of this matrix to the double value of the Matrix3f argument.

public final void
set(Matrix3d
the source matrix3d
m1
)

Sets the value of this matrix to the value of the Matrix3d argument.

public final void
set(double[]
the double precision array of length 9
m
)

Sets the values in this Matrix3d equal to the row-major array parameter (ie, the first three elements of the array will be copied into the first row of this matrix, etc.).

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
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
)

Sets the specified column of this matrix3d to the three values provided.

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

Sets the specified column of this matrix3d 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 matrix3d to the three 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 matrix3f to the value provided.

public final void
setIdentity()

Sets this Matrix3d 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
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
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
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
)

Sets the specified row of this matrix3d to the 4 values provided.

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

Sets the specified row of this matrix3d 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 matrix3d to the three 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) and multiplying by the new scale.

public final void
setZero()

Sets this matrix to all zeros.

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

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

public final void
sub(Matrix3d
the other matrix
m1
)

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

pack-priv static void
svdReorder(double[] m, double[] t1, double[] t2, double[] scales, double[] outRot, double[] outScale)

public String

Returns:

the String representation
toString
()

Overrides java.lang.Object.toString.

Returns a string that contains the values of this Matrix3d.
public final void
transform(Tuple3d
the tuple to be multiplied by this matrix and then replaced
t
)

Multiply this matrix by the tuple t and place the result back into the tuple (t = this*t).

public final void
transform(Tuple3d
the tuple to be multiplied by this matrix
t
,
Tuple3d
the tuple into which the product is placed
result
)

Multiply this matrix by the tuple t and and place the result into the tuple "result" (result = this*t).

public final void
transpose()

Sets the value of this matrix to its transpose.

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

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

pack-priv static void
transpose_mat(double[] in, double[] out)

Inherited from java.lang.Object:
finalizegetClassnotifynotifyAllwaitwaitwait