public class Matrix3d
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
double |
m00
The first element of the first row.
|
double |
m01
The second element of the first row.
|
double |
m02
third element of the first row.
|
double |
m10
The first element of the second row.
|
double |
m11
The second element of the second row.
|
double |
m12
The third element of the second row.
|
double |
m20
The first element of the third row.
|
double |
m21
The second element of the third row.
|
double |
m22
The third element of the third row.
|
Constructor and Description |
---|
Matrix3d()
Constructs and initializes a Matrix3d to all zeros.
|
Matrix3d(double[] v)
Constructs and initializes a Matrix3d from the specified 9
element array.
|
Matrix3d(double m00,
double m01,
double m02,
double m10,
double m11,
double m12,
double m20,
double m21,
double m22)
Constructs and initializes a Matrix3d from the specified nine values.
|
Matrix3d(Matrix3d m1)
Constructs a new matrix with the same values as the Matrix3d parameter.
|
Matrix3d(Matrix3f m1)
Constructs a new matrix with the same values as the Matrix3f parameter.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double scalar)
Adds a scalar to each component of this matrix.
|
void |
add(double scalar,
Matrix3d m1)
Adds a scalar to each component of the matrix m1 and places
the result into this.
|
void |
add(Matrix3d m1)
Sets the value of this matrix to sum of itself and matrix m1.
|
void |
add(Matrix3d m1,
Matrix3d m2)
Sets the value of this matrix to the matrix sum of matrices m1 and m2.
|
double |
determinant()
Computes the determinant of this matrix.
|
boolean |
epsilonEquals(Matrix3d 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.
|
boolean |
equals(Matrix3d m1)
Returns true if all of the data members of Matrix3d m1 are
equal to the corresponding data members in this Matrix3d.
|
boolean |
equals(java.lang.Object o1)
Returns true if the Object o1 is of type Matrix3d and all of the data
members of t1 are equal to the corresponding data members in this
Matrix3d.
|
void |
getColumn(int column,
double[] v)
Copies the matrix values in the specified column into the array
parameter.
|
void |
getColumn(int column,
Vector3d v)
Copies the matrix values in the specified column into the vector
parameter.
|
double |
getElement(int row,
int column)
Retrieves the value at the specified row and column of this matrix.
|
void |
getRow(int row,
double[] v)
Copies the matrix values in the specified row into the
array parameter.
|
void |
getRow(int row,
Vector3d v)
Copies the matrix values in the specified row into the
vector parameter.
|
double |
getScale()
Performs an SVD normalization of this matrix to calculate and return the
uniform scale factor.
|
int |
hashCode()
Returns a hash number based on the data values in this
object.
|
void |
invert()
Sets the value of this matrix to its inverse.
|
void |
invert(Matrix3d m1)
Sets the value of this matrix to the matrix inverse
of the passed matrix m1.
|
void |
mul(double scalar)
Multiplies each element of this matrix by a scalar.
|
void |
mul(double scalar,
Matrix3d m1)
Multiplies each element of matrix m1 by a scalar and places the result
into this.
|
void |
mul(Matrix3d m1)
Sets the value of this matrix to the result of multiplying itself
with matrix m1.
|
void |
mul(Matrix3d m1,
Matrix3d m2)
Sets the value of this matrix to the result of multiplying
the two argument matrices together.
|
void |
mulNormalize(Matrix3d 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).
|
void |
mulNormalize(Matrix3d m1,
Matrix3d 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).
|
void |
mulTransposeBoth(Matrix3d m1,
Matrix3d m2)
Multiplies the transpose of matrix m1 times the transpose of matrix m2,
and places the result into this.
|
void |
mulTransposeLeft(Matrix3d m1,
Matrix3d m2)
Multiplies the transpose of matrix m1 times matrix m2, and places the
result into this.
|
void |
mulTransposeRight(Matrix3d m1,
Matrix3d m2)
Multiplies matrix m1 times the transpose of matrix m2, and places the
result into this.
|
void |
negate()
Negates the value of this matrix: this = -this.
|
void |
negate(Matrix3d m1)
Sets the value of this matrix equal to the negation of of the Matrix3d
parameter.
|
void |
normalize()
Performs singular value decomposition normalization of this matrix.
|
void |
normalize(Matrix3d m1)
Perform singular value decomposition normalization of matrix m1 and
place the normalized values into this.
|
void |
normalizeCP()
Perform cross product normalization of this matrix.
|
void |
normalizeCP(Matrix3d m1)
Perform cross product normalization of matrix m1 and place the
normalized values into this.
|
void |
rotX(double angle)
Sets the value of this matrix to a rotation matrix about the x axis
by the passed angle.
|
void |
rotY(double angle)
Sets the value of this matrix to a rotation matrix about the y axis
by the passed angle.
|
void |
rotZ(double angle)
Sets the value of this matrix to a rotation matrix about the z axis
by the passed angle.
|
void |
set(AxisAngle4d a1)
Sets the value of this matrix to the matrix conversion of the
double precision axis and angle argument.
|
void |
set(AxisAngle4f a1)
Sets the value of this matrix to the matrix conversion of the
single precision axis and angle argument.
|
void |
set(double scale)
Sets the value of this matrix to a scale matrix with the
passed scale amount.
|
void |
set(double[] m)
Sets the values in this Matrix3d 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.).
|
void |
set(Matrix3d m1)
Sets the value of this matrix to the value of the Matrix3d
argument.
|
void |
set(Matrix3f m1)
Sets the value of this matrix to the double value of the Matrix3f
argument.
|
void |
set(Quat4d q1)
Sets the value of this matrix to the matrix conversion of the
(double precision) quaternion argument.
|
void |
set(Quat4f q1)
Sets the value of this matrix to the matrix conversion of the
single precision quaternion argument.
|
void |
setColumn(int column,
double[] v)
Sets the specified column of this matrix3d to the four values provided.
|
void |
setColumn(int column,
double x,
double y,
double z)
Sets the specified column of this matrix3d to the three values provided.
|
void |
setColumn(int column,
Vector3d v)
Sets the specified column of this matrix3d to the vector provided.
|
void |
setElement(int row,
int column,
double value)
Sets the specified element of this matrix3d to the value provided.
|
void |
setIdentity()
Sets this Matrix3d to identity.
|
void |
setRow(int row,
double[] v)
Sets the specified row of this matrix3d to the four values provided.
|
void |
setRow(int row,
double x,
double y,
double z)
Sets the specified row of this matrix3d to the three values provided.
|
void |
setRow(int row,
Vector3d v)
Sets the specified row of this matrix3d to the Vector provided.
|
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.
|
void |
setZero()
Sets this matrix to all zeros.
|
void |
sub(Matrix3d m1)
Sets the value of this matrix to the matrix difference of itself
and matrix m1 (this = this - m1).
|
void |
sub(Matrix3d m1,
Matrix3d m2)
Sets the value of this matrix to the matrix difference
of matrices m1 and m2.
|
java.lang.String |
toString()
Returns a string that contains the values of this Matrix3d.
|
void |
transform(Tuple3d t)
Transform the vector vec using this Matrix3d and place the
result back into vec.
|
void |
transform(Tuple3d t,
Tuple3d result)
Transform the vector vec using this Matrix3d and place the
result into vecOut.
|
void |
transpose()
Sets the value of this matrix to its transpose.
|
void |
transpose(Matrix3d m1)
Sets the value of this matrix to the transpose of the argument matrix
|
public double m00
public double m01
public double m02
public double m10
public double m11
public double m12
public double m20
public double m21
public double m22
public Matrix3d(double m00, double m01, double m02, double m10, double m11, double m12, double m20, double m21, double m22)
m00
- the [0][0] elementm01
- the [0][1] elementm02
- the [0][2] elementm10
- the [1][0] elementm11
- the [1][1] elementm12
- the [1][2] elementm20
- the [2][0] elementm21
- the [2][1] elementm22
- the [2][2] elementpublic Matrix3d(double[] v)
v
- the array of length 9 containing in orderpublic Matrix3d(Matrix3d m1)
m1
- The source matrix.public Matrix3d(Matrix3f m1)
m1
- The source matrix.public Matrix3d()
public java.lang.String toString()
toString
in class java.lang.Object
public final void setIdentity()
public final void setScale(double scale)
scale
- the new scale amountpublic final void setElement(int row, int column, double value)
row
- the row number to be modified (zero indexed)column
- the column number to be modified (zero indexed)value
- the new valuepublic final double getElement(int row, int column)
row
- the row number to be retrieved (zero indexed)column
- the column number to be retrieved (zero indexed)public final void setRow(int row, double x, double y, double z)
row
- the row number to be modified (zero indexed)x
- the first column elementy
- the second column elementz
- the third column elementpublic final void setRow(int row, Vector3d v)
row
- the row number to be modified (zero indexed)v
- the replacement rowpublic final void setRow(int row, double[] v)
row
- the row number to be modified (zero indexed)v
- the replacement rowpublic final void getRow(int row, double[] v)
row
- the matrix rowv
- The array into which the matrix row values will be copiedpublic final void getRow(int row, Vector3d v)
row
- the matrix rowv
- The vector into which the matrix row values will be copiedpublic final void setColumn(int column, double x, double y, double z)
column
- the column number to be modified (zero indexed)x
- the first row elementy
- the second row elementz
- the third row elementpublic final void setColumn(int column, Vector3d v)
column
- the column number to be modified (zero indexed)v
- the replacement columnpublic final void setColumn(int column, double[] v)
column
- the column number to be modified (zero indexed)v
- the replacement columnpublic final void getColumn(int column, Vector3d v)
column
- the matrix columnv
- The vector into which the matrix row values will be copiedpublic final void getColumn(int column, double[] v)
column
- the matrix columnv
- The array into which the matrix row values will be copiedpublic final double getScale()
public final void add(double scalar)
scalar
- The scalar adder.public final void add(double scalar, Matrix3d m1)
scalar
- The scalar adder.public final void add(Matrix3d m1, Matrix3d m2)
m1
- the first matrixm2
- the second matrixpublic final void add(Matrix3d m1)
m1
- the other matrixpublic final void sub(Matrix3d m1, Matrix3d m2)
m1
- the first matrixm2
- the second matrixpublic final void sub(Matrix3d m1)
m1
- the other matrixpublic final void transpose()
public final void transpose(Matrix3d m1)
m1
- the matrix to be transposedpublic final void set(Quat4d q1)
q1
- the quaternion to be convertedpublic final void set(AxisAngle4d a1)
a1
- the axis and angle to be convertedpublic final void set(Quat4f q1)
q1
- the quaternion to be convertedpublic final void set(AxisAngle4f a1)
a1
- the axis and angle to be convertedpublic final void set(Matrix3d m1)
public final void set(Matrix3f m1)
m1
- the matrix3f to be converted to doublepublic final void set(double[] m)
public final void invert(Matrix3d m1)
m1
- the matrix to be invertedpublic final void invert()
public final double determinant()
public final void set(double scale)
scale
- the scale factor for the matrixpublic final void rotX(double angle)
angle
- the angle to rotate about the X axis in radianspublic final void rotY(double angle)
angle
- the angle to rotate about the Y axis in radianspublic final void rotZ(double angle)
angle
- the angle to rotate about the Z axis in radianspublic final void mul(double scalar)
scalar
- The scalar multiplier.public final void mul(double scalar, Matrix3d m1)
scalar
- The scalar multiplier.m1
- The original matrix.public final void mul(Matrix3d m1)
m1
- the other matrixpublic final void mul(Matrix3d m1, Matrix3d m2)
m1
- the first matrixm2
- the second matrixpublic final void mulNormalize(Matrix3d m1)
m1
- the matrix on the right hand side of the multiplicationpublic final void mulNormalize(Matrix3d m1, Matrix3d m2)
m1
- the matrix on the left hand side of the multiplicationm2
- the matrix on the right hand side of the multiplicationpublic final void mulTransposeBoth(Matrix3d m1, Matrix3d m2)
m1
- The matrix on the left hand side of the multiplicationm2
- The matrix on the right hand side of the multiplicationpublic final void mulTransposeRight(Matrix3d m1, Matrix3d m2)
m1
- The matrix on the left hand side of the multiplicationm2
- The matrix on the right hand side of the multiplicationpublic final void mulTransposeLeft(Matrix3d m1, Matrix3d m2)
m1
- The matrix on the left hand side of the multiplicationm2
- The matrix on the right hand side of the multiplicationpublic final void normalize()
public final void normalize(Matrix3d m1)
m1
- Provides the matrix values to be normalizedpublic final void normalizeCP()
public final void normalizeCP(Matrix3d m1)
m1
- Provides the matrix values to be normalizedpublic boolean equals(Matrix3d m1)
m1
- The matrix with which the comparison is made.public boolean equals(java.lang.Object o1)
equals
in class java.lang.Object
o1
- the object with which the comparison is made.public boolean epsilonEquals(Matrix3d m1, double epsilon)
m1
- The matrix to be compared to this matrixepsilon
- the threshold valuepublic int hashCode()
hashCode
in class java.lang.Object
public final void setZero()
public final void negate()
public final void negate(Matrix3d m1)
m1
- The source matrixpublic final void transform(Tuple3d t)
vec
- the double precision vector to be transformed