org.openmali.vecmath2
Class Matrix3f

java.lang.Object
  extended by org.openmali.vecmath2.MatrixMxNf
      extended by org.openmali.vecmath2.Matrix3f
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable, java.lang.Cloneable

public class Matrix3f
extends MatrixMxNf
implements java.io.Externalizable, java.lang.Cloneable

A single precision floating point 3 by 3 matrix. Inspired by Kenji Hiranabe's Matrix3f implementation

See Also:
Serialized Form

Field Summary
static Matrix3f IDENTITY
           
protected static int M
           
protected static int N
           
static Matrix3f ROT_MINUS_90_DEG_BY_X_AXIS
           
static Matrix3f ROT_MINUS_90_DEG_BY_Y_AXIS
           
static Matrix3f ROT_MINUS_90_DEG_BY_Z_AXIS
           
static Matrix3f ROT_PLUS_90_DEG_BY_X_AXIS
           
static Matrix3f ROT_PLUS_90_DEG_BY_Y_AXIS
           
static Matrix3f ROT_PLUS_90_DEG_BY_Z_AXIS
           
static Matrix3f Z_UP_TO_Y_UP
           
static Matrix3f ZERO
           
 
Fields inherited from class org.openmali.vecmath2.MatrixMxNf
colSkip, dataBegin, isDirty, roTrick, values
 
Constructor Summary
  Matrix3f()
          Constructs and initializes a Matrix3f to all zeros.
protected Matrix3f(boolean readOnly)
          Constructs and initializes a Matrix3f to all zeros.
protected Matrix3f(boolean readOnly, float[] values)
          Constructs and initializes a Matrix3f from the specified 9 element array.
protected Matrix3f(boolean readOnly, float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          Constructs and initializes a Matrix3f from the specified nine values.
protected Matrix3f(boolean readOnly, int dataBegin, int colSkip, float[] values, boolean[] isDirty)
          Hidden constructor for sharedSubMatrix3f(MatrixMxNf, int, int).
protected Matrix3f(boolean readOnly, Matrix3f mat)
          Constructs a new matrix with the same values as the Matrix3f parameter.
  Matrix3f(float[] values)
          Constructs and initializes a Matrix3f from the specified 9 element array.
  Matrix3f(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          Constructs and initializes a Matrix3f from the specified nine values.
protected Matrix3f(int dataBegin, int colSkip, float[] values, boolean[] isDirty)
          Hidden constructor for sharedSubMatrix3f(MatrixMxNf, int, int).
  Matrix3f(Matrix3f mat)
          Constructs a new matrix with the same values as the Matrix3f parameter.
 
Method Summary
 void add(Matrix3f m2)
          Sets the value of this matrix to sum of itself and matrix m2.
 void add(Matrix3f m1, Matrix3f m2)
          Sets the value of this matrix to the matrix sum of matrices m1 and m2.
 Matrix3f asReadOnly()
          
 Matrix3f clone()
          
 float determinant()
          Computes the determinant of this matrix.
 boolean epsilonEquals(Matrix3f m2, float 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(Matrix3f m2)
          Returns true if all of the data members of Matrix3f m1 are equal to the corresponding data members in this Matrix3f.
 boolean equals(java.lang.Object o)
          Returns true if the Object o1 is of type Matrix3f and all of the data members of t1 are equal to the corresponding data members in this Matrix3f.
static Matrix3f fromPool()
          Allocates an Matrix3f instance from the pool.
 Matrix3f getColumn(int column, Tuple3f t3f)
          Copies the matrix values in the specified column into the vector parameter.
 Matrix3f getReadOnly()
          
 Matrix3f getRow(int row, Tuple3f t3f)
          Copies the matrix values in the specified row into the vector parameter.
 float 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 interpolate(Matrix3f m1, Matrix3f m2, float alpha)
          Interpolates each value of this Matrix by the value alpha.
 Matrix3f invert()
          Sets the value of this matrix to its inverse.
 void invert(Matrix3f mat)
          Sets the value of this matrix to the matrix inverse of the passed matrix mat.
 float m00()
           
 Matrix3f m00(float v)
           
 float m01()
           
 Matrix3f m01(float v)
           
 float m02()
           
 Matrix3f m02(float v)
           
 float m10()
           
 Matrix3f m10(float v)
           
 float m11()
           
 Matrix3f m11(float v)
           
 float m12()
           
 Matrix3f m12(float v)
           
 float m20()
           
 Matrix3f m20(float v)
           
 float m21()
           
 Matrix3f m21(float v)
           
 float m22()
           
 Matrix3f m22(float v)
           
 Matrix3f mul(float scalar)
          Multiplies this Matrix with a scalar.
 void mul(float scalar, Matrix3f mat)
          Multiplies each element of matrix m1 by a scalar and places the result into this.
 void mul(Matrix3f mat)
          Sets the value of this matrix to the result of multiplying itself with matrix mat.
 void mul(Matrix3f mat1, Matrix3f mat2)
          Sets the value of this matrix to the result of multiplying the two argument matrices together.
 void mul(Tuple3f vec, Tuple3f t3dOut)
           
 void mulNormalize(Matrix3f mat)
          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(Matrix3f mat1, Matrix3f mat2)
          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(Matrix3f mat1, Matrix3f mat2)
          Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.
 void mulTransposeLeft(Matrix3f mat1, Matrix3f mat2)
          Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.
 void mulTransposeRight(Matrix3f m1, Matrix3f m2)
          Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.
 Matrix3f negate(Matrix3f mat)
          Sets the value of this matrix equal to the negation of of the Matrix3f parameter.
static Matrix3f newReadOnly()
          Constructs and initializes a Matrix3f to all zeros.
static Matrix3f newReadOnly(float[] values)
          Constructs and initializes a Matrix3f from the specified 9 element array.
static Matrix3f newReadOnly(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          Constructs and initializes a Matrix3f from the specified nine values.
static Matrix3f newReadOnly(Matrix3f mat)
          Constructs a new matrix with the same values as the Matrix3f parameter.
 Matrix3f normalize()
          Performs singular value decomposition normalization of this matrix.
 Matrix3f normalize(Matrix3f mat)
          Perform singular value decomposition normalization of matrix m1 and place the normalized values into this.
 Matrix3f normalizeCP()
          Performs cross product normalization of this matrix.
 Matrix3f normalizeCP(Matrix3f mat)
          Performs cross product normalization of matrix m1 and place the normalized values into this.
 java.nio.FloatBuffer readFromBuffer(java.nio.FloatBuffer buffer)
          Reads the contents of this matrix column-wise from a FloatBuffer.
 java.nio.FloatBuffer readFromBuffer(java.nio.FloatBuffer buffer, int position)
          Reads the contents of this matrix column-wise from a FloatBuffer.
static java.nio.FloatBuffer readFromBuffer(Matrix3f[] matrices, java.nio.FloatBuffer buffer)
          Reads the contents of this matrix column-wise from a FloatBuffer.
static java.nio.FloatBuffer readFromBuffer(Matrix3f[] matrices, java.nio.FloatBuffer buffer, int position)
          Reads the contents of this matrix column-wise from a FloatBuffer.
 void rotX(float angle)
          Sets the value of this matrix to a rotation matrix about the x axis by the passed angle.
 void rotY(float angle)
          Sets the value of this matrix to a rotation matrix about the y axis by the passed angle.
 void rotZ(float angle)
          Sets the value of this matrix to a rotation matrix about the z axis by the passed angle.
 void set(AxisAngle3f aa3f)
          Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.
 Matrix3f set(float scale)
          Sets the value of this matrix to a scale matrix with the passed scale amount.
 Matrix3f set(float m00, float m01, float m02, float m10, float m11, float m12, float m20, float m21, float m22)
          Sets 9 values
 void set(Quaternion4f quat)
          Sets the value of this matrix to the matrix conversion of the (single precision) quaternion argument.
 Matrix3f setColumn(int column, float x, float y, float z)
          Sets the specified column of this matrix3d to the three values provided.
 Matrix3f setColumn(int column, Tuple3f t3f)
          Sets the specified column of this matrix3d to the vector provided.
 void setCross(Vector3f v)
          Sets this matrix, so that
this.transform(a) = v x a
 void setCross(Vector3f v, boolean notInverted)
          Sets this matrix, so that
this.transform(a) = v x a
by setting pos = false a negative version gets written
 Matrix3f setRow(int row, float x, float y, float z)
          Sets the specified row of this matrix3d to the three values provided.
 Matrix3f setRow(int row, Tuple3f t3f)
          Sets the specified row of this matrix3d to the Vector provided.
static Matrix3f sharedSubMatrix3f(MatrixMxNf mat, int beginRow, int beginCol)
          Creates a Submatrix of mat, that begins in beginRow and beginCol.
 void sub(Matrix3f m2)
          Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).
 void sub(Matrix3f m1, Matrix3f m2)
          Sets the value of this matrix to the matrix difference of matrices m1 and m2.
static void toPool(Matrix3f o)
          Stores the given Matrix3f instance in the pool.
 void transform(Tuple3f t3f)
          Transform the vector vec using this Matrix3f and place the result back into t3f.
 void transform(Tuple3f t3f, Tuple3f result)
          Transform the vector vec using this Matrix3f and place the result into vecOut.
 Matrix3f transpose(Matrix3f mat)
          Sets the value of this matrix to the transpose of the argument matrix
 java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer, boolean clear, boolean flip)
          Writes the contents of this matrix column-wise to a FloatBuffer.
 java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer, int position, boolean clear, boolean flip)
          Writes the contents of this matrix column-wise to a FloatBuffer.
static java.nio.FloatBuffer writeToBuffer(Matrix3f[] matrices, java.nio.FloatBuffer buffer, boolean clear, boolean flip)
          Writes the contents of this matrix column-wise to a FloatBuffer.
static java.nio.FloatBuffer writeToBuffer(Matrix3f[] matrices, java.nio.FloatBuffer buffer, int position, boolean clear, boolean flip)
          Writes the contents of this matrix column-wise to a FloatBuffer.
 
Methods inherited from class org.openmali.vecmath2.MatrixMxNf
add, add, add, add, cond, copySubMatrix, deserialize, div, epsilonEquals, equals, get, get, get, get, get, getColumn, getColumn, getColumnMajor, getColumnMajor, getNumCols, getNumRows, getRow, getRow, getRowMajor, getRowMajor, getSerializationBufferSize, getSharedSubMatrix, getSharedSubMatrix, identityMinus, interpolate, invert, isDirty, isPositiveDefinite, isPositiveDefinite, isReadOnly, isSquare, isSubMatrix, LUD, mul, mul, mul, mul, mulComp, mulComp, mulTransposeBoth, mulTransposeLeft, mulTransposeRight, negate, negate, newReadOnly, newReadOnly, newReadOnly, norm1, norm2, normFrobenius, normInfinity, rank, readExternal, serialize, set, set, set, set, set, setClean, setColumn, setColumn, setColumnMajor, setColumnMajor, setIdentity, setRow, setRow, setRowMajor, setRowMajor, setScale, setZero, sharedSubMatrixMxNf, sharedSubMatrixMxNf, solve, solve, sub, sub, sub, sub, SVD, toString, trace, transpose, transpose, writeExternal
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Field Detail

ZERO

public static final Matrix3f ZERO

IDENTITY

public static final Matrix3f IDENTITY

ROT_PLUS_90_DEG_BY_X_AXIS

public static final Matrix3f ROT_PLUS_90_DEG_BY_X_AXIS

ROT_MINUS_90_DEG_BY_X_AXIS

public static final Matrix3f ROT_MINUS_90_DEG_BY_X_AXIS

ROT_PLUS_90_DEG_BY_Y_AXIS

public static final Matrix3f ROT_PLUS_90_DEG_BY_Y_AXIS

ROT_MINUS_90_DEG_BY_Y_AXIS

public static final Matrix3f ROT_MINUS_90_DEG_BY_Y_AXIS

ROT_PLUS_90_DEG_BY_Z_AXIS

public static final Matrix3f ROT_PLUS_90_DEG_BY_Z_AXIS

ROT_MINUS_90_DEG_BY_Z_AXIS

public static final Matrix3f ROT_MINUS_90_DEG_BY_Z_AXIS

Z_UP_TO_Y_UP

public static final Matrix3f Z_UP_TO_Y_UP

M

protected static final int M
See Also:
Constant Field Values

N

protected static final int N
See Also:
Constant Field Values
Constructor Detail

Matrix3f

protected Matrix3f(boolean readOnly)
Constructs and initializes a Matrix3f to all zeros.


Matrix3f

protected Matrix3f(boolean readOnly,
                   float m00,
                   float m01,
                   float m02,
                   float m10,
                   float m11,
                   float m12,
                   float m20,
                   float m21,
                   float m22)
Constructs and initializes a Matrix3f from the specified nine values.

Parameters:
m00 - the [0][0] element
m01 - the [0][1] element
m02 - the [0][2] element
m10 - the [1][0] element
m11 - the [1][1] element
m12 - the [1][2] element
m20 - the [2][0] element
m21 - the [2][1] element
m22 - the [2][2] element

Matrix3f

protected Matrix3f(boolean readOnly,
                   float[] values)
Constructs and initializes a Matrix3f from the specified 9 element array. this.m00 =v[0], this.m01=v[1], etc.

Parameters:
values - the array of length 9 containing in order

Matrix3f

protected Matrix3f(boolean readOnly,
                   Matrix3f mat)
Constructs a new matrix with the same values as the Matrix3f parameter.

Parameters:
mat - The source matrix.

Matrix3f

protected Matrix3f(boolean readOnly,
                   int dataBegin,
                   int colSkip,
                   float[] values,
                   boolean[] isDirty)
Hidden constructor for sharedSubMatrix3f(MatrixMxNf, int, int).

Parameters:
readOnly -
dataBegin -
colSkip -
values -
isDirty -
See Also:
sharedSubMatrix3f(MatrixMxNf, int, int), MatrixMxNf.MatrixMxNf(int, int, int, int, float[])

Matrix3f

public Matrix3f()
Constructs and initializes a Matrix3f to all zeros.


Matrix3f

public Matrix3f(float m00,
                float m01,
                float m02,
                float m10,
                float m11,
                float m12,
                float m20,
                float m21,
                float m22)
Constructs and initializes a Matrix3f from the specified nine values.

Parameters:
m00 - the [0][0] element
m01 - the [0][1] element
m02 - the [0][2] element
m10 - the [1][0] element
m11 - the [1][1] element
m12 - the [1][2] element
m20 - the [2][0] element
m21 - the [2][1] element
m22 - the [2][2] element

Matrix3f

public Matrix3f(float[] values)
Constructs and initializes a Matrix3f from the specified 9 element array. this.m00 =v[0], this.m01=v[1], etc.

Parameters:
values - the array of length 9 containing in order

Matrix3f

public Matrix3f(Matrix3f mat)
Constructs a new matrix with the same values as the Matrix3f parameter.

Parameters:
mat - The source matrix.

Matrix3f

protected Matrix3f(int dataBegin,
                   int colSkip,
                   float[] values,
                   boolean[] isDirty)
Hidden constructor for sharedSubMatrix3f(MatrixMxNf, int, int).

Parameters:
dataBegin -
colSkip -
values -
isDirty -
See Also:
sharedSubMatrix3f(MatrixMxNf, int, int), MatrixMxNf.MatrixMxNf(int, int, int, int, float[])
Method Detail

m00

public final float m00()

m01

public final float m01()

m02

public final float m02()

m10

public final float m10()

m11

public final float m11()

m12

public final float m12()

m20

public final float m20()

m21

public final float m21()

m22

public final float m22()

m00

public final Matrix3f m00(float v)

m01

public final Matrix3f m01(float v)

m02

public final Matrix3f m02(float v)

m10

public final Matrix3f m10(float v)

m11

public final Matrix3f m11(float v)

m12

public final Matrix3f m12(float v)

m20

public final Matrix3f m20(float v)

m21

public final Matrix3f m21(float v)

m22

public final Matrix3f m22(float v)

setRow

public final Matrix3f setRow(int row,
                             float x,
                             float y,
                             float z)
Sets the specified row of this matrix3d to the three values provided.

Parameters:
row - the row number to be modified (zero indexed)
x - the first column element
y - the second column element
z - the third column element
Returns:
itself

setRow

public final Matrix3f setRow(int row,
                             Tuple3f t3f)
Sets the specified row of this matrix3d to the Vector provided.

Parameters:
row - the row number to be modified (zero indexed)
t3f - the replacement row
Returns:
itself

getRow

public final Matrix3f getRow(int row,
                             Tuple3f t3f)
Copies the matrix values in the specified row into the vector parameter.

Parameters:
row - the matrix row
t3f - The vector into which the matrix row values will be copied
Returns:
itself

setColumn

public final Matrix3f setColumn(int column,
                                float x,
                                float y,
                                float z)
Sets the specified column of this matrix3d to the three values provided.

Parameters:
column - the column number to be modified (zero indexed)
x - the first row element
y - the second row element
z - the third row element
Returns:
itself

setColumn

public final Matrix3f setColumn(int column,
                                Tuple3f t3f)
Sets the specified column of this matrix3d to the vector provided.

Parameters:
column - the column number to be modified (zero indexed)
t3f - the replacement column
Returns:
itself

getColumn

public final Matrix3f getColumn(int column,
                                Tuple3f t3f)
Copies the matrix values in the specified column into the vector parameter.

Parameters:
column - the matrix column
t3f - The vector into which the matrix row values will be copied
Returns:
itself

set

public final Matrix3f set(float scale)
Sets the value of this matrix to a scale matrix with the passed scale amount.

Parameters:
scale - the scale factor for the matrix
Returns:
itself

getScale

public final float getScale()
Performs an SVD normalization of this matrix to calculate and return the uniform scale factor. This matrix is not modified.

Returns:
the scale factor of this matrix

set

public final void set(Quaternion4f quat)
Sets the value of this matrix to the matrix conversion of the (single precision) quaternion argument.

Parameters:
quat - the quaternion to be converted

set

public final void set(AxisAngle3f aa3f)
Sets the value of this matrix to the matrix conversion of the single precision axis and angle argument.

Parameters:
aa3f - the axis and angle to be converted

set

public final Matrix3f set(float m00,
                          float m01,
                          float m02,
                          float m10,
                          float m11,
                          float m12,
                          float m20,
                          float m21,
                          float m22)
Sets 9 values

Parameters:
m00 -
m01 -
m02 -
m10 -
m11 -
m12 -
m20 -
m21 -
m22 -
Returns:
itself

writeToBuffer

public java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer,
                                          boolean clear,
                                          boolean flip)
Writes the contents of this matrix column-wise to a FloatBuffer.

Parameters:
buffer -
clear - clear the buffer before writing data?
flip - flip the buffer after writing data?
Returns:
itself

writeToBuffer

public java.nio.FloatBuffer writeToBuffer(java.nio.FloatBuffer buffer,
                                          int position,
                                          boolean clear,
                                          boolean flip)
Writes the contents of this matrix column-wise to a FloatBuffer.

Parameters:
buffer -
position - position in the buffer
clear - clear the buffer before writing data?
flip - flip the buffer after writing data?
Returns:
itself

writeToBuffer

public static java.nio.FloatBuffer writeToBuffer(Matrix3f[] matrices,
                                                 java.nio.FloatBuffer buffer,
                                                 boolean clear,
                                                 boolean flip)
Writes the contents of this matrix column-wise to a FloatBuffer.

Parameters:
matrices -
buffer -
clear - clear the buffer before writing data?
flip - flip the buffer after writing data?
Returns:
itself

writeToBuffer

public static java.nio.FloatBuffer writeToBuffer(Matrix3f[] matrices,
                                                 java.nio.FloatBuffer buffer,
                                                 int position,
                                                 boolean clear,
                                                 boolean flip)
Writes the contents of this matrix column-wise to a FloatBuffer.

Parameters:
matrices -
buffer -
position - position in the buffer
clear - clear the buffer before writing data?
flip - flip the buffer after writing data?
Returns:
itself

readFromBuffer

public java.nio.FloatBuffer readFromBuffer(java.nio.FloatBuffer buffer)
Reads the contents of this matrix column-wise from a FloatBuffer.

Parameters:
buffer -
Returns:
itself

readFromBuffer

public java.nio.FloatBuffer readFromBuffer(java.nio.FloatBuffer buffer,
                                           int position)
Reads the contents of this matrix column-wise from a FloatBuffer.

Parameters:
buffer -
position - position in the buffer
Returns:
itself

readFromBuffer

public static java.nio.FloatBuffer readFromBuffer(Matrix3f[] matrices,
                                                  java.nio.FloatBuffer buffer)
Reads the contents of this matrix column-wise from a FloatBuffer.

Parameters:
matrices -
buffer -
Returns:
itself

readFromBuffer

public static java.nio.FloatBuffer readFromBuffer(Matrix3f[] matrices,
                                                  java.nio.FloatBuffer buffer,
                                                  int position)
Reads the contents of this matrix column-wise from a FloatBuffer.

Parameters:
matrices -
buffer -
position - position in the buffer
Returns:
itself

negate

public final Matrix3f negate(Matrix3f mat)
Sets the value of this matrix equal to the negation of of the Matrix3f parameter.

Parameters:
mat - The source matrix
Returns:
itself

determinant

public final float determinant()
Computes the determinant of this matrix.

Returns:
the determinant of the matrix

normalize

public final Matrix3f normalize()
Performs singular value decomposition normalization of this matrix.

Returns:
itself

normalize

public final Matrix3f normalize(Matrix3f mat)
Perform singular value decomposition normalization of matrix m1 and place the normalized values into this.

Parameters:
mat - Provides the matrix values to be normalized
Returns:
itself

normalizeCP

public final Matrix3f normalizeCP()
Performs cross product normalization of this matrix.

Returns:
itself

normalizeCP

public final Matrix3f normalizeCP(Matrix3f mat)
Performs cross product normalization of matrix m1 and place the normalized values into this.

Parameters:
mat - Provides the matrix values to be normalized
Returns:
itself

transpose

public final Matrix3f transpose(Matrix3f mat)
Sets the value of this matrix to the transpose of the argument matrix

Parameters:
mat - the matrix to be transposed
Returns:
itself

mul

public Matrix3f mul(float scalar)
Multiplies this Matrix with a scalar.

Overrides:
mul in class MatrixMxNf
Returns:
itself

invert

public Matrix3f invert()
Sets the value of this matrix to its inverse.

Overrides:
invert in class MatrixMxNf
Returns:
itself

invert

public final void invert(Matrix3f mat)
Sets the value of this matrix to the matrix inverse of the passed matrix mat.

Parameters:
mat - the matrix to be inverted

transform

public final void transform(Tuple3f t3f,
                            Tuple3f result)
Transform the vector vec using this Matrix3f and place the result into vecOut.

Parameters:
t3f - the single precision vector to be transformed
result - the vector into which the transformed values are placed

transform

public final void transform(Tuple3f t3f)
Transform the vector vec using this Matrix3f and place the result back into t3f.

Parameters:
t3f - the single precision vector to be transformed

add

public final void add(Matrix3f m1,
                      Matrix3f m2)
Sets the value of this matrix to the matrix sum of matrices m1 and m2.

Parameters:
m1 - the first matrix
m2 - the second matrix

add

public final void add(Matrix3f m2)
Sets the value of this matrix to sum of itself and matrix m2.

Parameters:
m2 - the other matrix

sub

public final void sub(Matrix3f m1,
                      Matrix3f m2)
Sets the value of this matrix to the matrix difference of matrices m1 and m2.

Parameters:
m1 - the first matrix
m2 - the second matrix

sub

public final void sub(Matrix3f m2)
Sets the value of this matrix to the matrix difference of itself and matrix m1 (this = this - m1).

Parameters:
m2 - the other matrix

rotX

public final void rotX(float angle)
Sets the value of this matrix to a rotation matrix about the x axis by the passed angle.

Parameters:
angle - the angle to rotate about the X axis in radians

rotY

public final void rotY(float angle)
Sets the value of this matrix to a rotation matrix about the y axis by the passed angle.

Parameters:
angle - the angle to rotate about the Y axis in radians

rotZ

public final void rotZ(float angle)
Sets the value of this matrix to a rotation matrix about the z axis by the passed angle.

Parameters:
angle - the angle to rotate about the Z axis in radians

mul

public final void mul(float scalar,
                      Matrix3f mat)
Multiplies each element of matrix m1 by a scalar and places the result into this. Matrix m1 is not modified.

Parameters:
scalar - The scalar multiplier.
mat - The original matrix.

mul

public final void mul(Matrix3f mat1,
                      Matrix3f mat2)
Sets the value of this matrix to the result of multiplying the two argument matrices together.

Parameters:
mat1 - the first matrix
mat2 - the second matrix

mul

public final void mul(Matrix3f mat)
Sets the value of this matrix to the result of multiplying itself with matrix mat.

Parameters:
mat - the other matrix

mul

public final void mul(Tuple3f vec,
                      Tuple3f t3dOut)

mulNormalize

public final void mulNormalize(Matrix3f mat)
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).

Parameters:
mat - the matrix on the right hand side of the multiplication

mulNormalize

public final void mulNormalize(Matrix3f mat1,
                               Matrix3f mat2)
Multiplies matrix m1 by matrix m2, does an SVD normalization of the result, and places the result into this matrix this = SVDnorm(m1*m2).

Parameters:
mat1 - the matrix on the left hand side of the multiplication
mat2 - the matrix on the right hand side of the multiplication

mulTransposeBoth

public final void mulTransposeBoth(Matrix3f mat1,
                                   Matrix3f mat2)
Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this.

Parameters:
mat1 - The matrix on the left hand side of the multiplication
mat2 - The matrix on the right hand side of the multiplication

mulTransposeRight

public final void mulTransposeRight(Matrix3f m1,
                                    Matrix3f m2)
Multiplies matrix m1 times the transpose of matrix m2, and places the result into this.

Parameters:
m1 - The matrix on the left hand side of the multiplication
m2 - The matrix on the right hand side of the multiplication

mulTransposeLeft

public final void mulTransposeLeft(Matrix3f mat1,
                                   Matrix3f mat2)
Multiplies the transpose of matrix m1 times matrix m2, and places the result into this.

Parameters:
mat1 - The matrix on the left hand side of the multiplication
mat2 - The matrix on the right hand side of the multiplication

setCross

public final void setCross(Vector3f v)
Sets this matrix, so that
this.transform(a) = v x a

Parameters:
v - the vector to compute the crossproduct to

setCross

public final void setCross(Vector3f v,
                           boolean notInverted)
Sets this matrix, so that
this.transform(a) = v x a
by setting pos = false a negative version gets written

Parameters:
v - the vector to compute the crossproduct to
notInverted - if true positive version or false to get a negative one

interpolate

public void interpolate(Matrix3f m1,
                        Matrix3f m2,
                        float alpha)
Interpolates each value of this Matrix by the value alpha. Mxy = M1xy + ( ( M2xy - M1xy ) * alpha )

Parameters:
m1 -
m2 -
alpha -

asReadOnly

public Matrix3f asReadOnly()

Overrides:
asReadOnly in class MatrixMxNf
Returns:
a new instance sharing the values array with this instance. The new instance is read-only. Changes to this instance will be reflected in the new read-only-instance.
See Also:
MatrixMxNf.getReadOnly()

getReadOnly

public Matrix3f getReadOnly()

Overrides:
getReadOnly in class MatrixMxNf
Returns:
a single instance sharing the values array with this instance (one unique instance per 'master-instance'). The instance is read-only. Changes to this instance will be reflected in the read-only-instance.
See Also:
MatrixMxNf.asReadOnly()

hashCode

public int hashCode()
Returns a hash number based on the data values in this object. Two different Matrix3f objects with identical data values (ie, returns true for equals(Matrix3f) ) will return the same hash number. Two objects with different data members may return the same hash value, although this is not likely.

Overrides:
hashCode in class MatrixMxNf
Returns:
the integer hash value

equals

public boolean equals(Matrix3f m2)
Returns true if all of the data members of Matrix3f m1 are equal to the corresponding data members in this Matrix3f.

Parameters:
m2 - The matrix with which the comparison is made.
Returns:
true or false

equals

public boolean equals(java.lang.Object o)
Returns true if the Object o1 is of type Matrix3f and all of the data members of t1 are equal to the corresponding data members in this Matrix3f.

Overrides:
equals in class MatrixMxNf
Parameters:
o - the object with which the comparison is made.

epsilonEquals

public boolean epsilonEquals(Matrix3f m2,
                             float 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. 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:
m2 - The matrix to be compared to this matrix
epsilon - the threshold value

clone

public Matrix3f clone()

Overrides:
clone in class MatrixMxNf

newReadOnly

public static Matrix3f newReadOnly()
Constructs and initializes a Matrix3f to all zeros.


newReadOnly

public static Matrix3f newReadOnly(float m00,
                                   float m01,
                                   float m02,
                                   float m10,
                                   float m11,
                                   float m12,
                                   float m20,
                                   float m21,
                                   float m22)
Constructs and initializes a Matrix3f from the specified nine values.

Parameters:
m00 - the [0][0] element
m01 - the [0][1] element
m02 - the [0][2] element
m10 - the [1][0] element
m11 - the [1][1] element
m12 - the [1][2] element
m20 - the [2][0] element
m21 - the [2][1] element
m22 - the [2][2] element

newReadOnly

public static Matrix3f newReadOnly(float[] values)
Constructs and initializes a Matrix3f from the specified 9 element array. this.m00 =v[0], this.m01=v[1], etc.

Parameters:
values - the array of length 9 containing in order

newReadOnly

public static Matrix3f newReadOnly(Matrix3f mat)
Constructs a new matrix with the same values as the Matrix3f parameter.

Parameters:
mat - The source matrix.

sharedSubMatrix3f

public static Matrix3f sharedSubMatrix3f(MatrixMxNf mat,
                                         int beginRow,
                                         int beginCol)
Creates a Submatrix of mat, that begins in beginRow and beginCol.
Example: let mat be a 4x4 matrix, and we want to have a 2x2 submatrix at position (1,2):
x x x x
x x y y
x x y y
x x x x
the y's mark the fetched Submatrix.
The produced submatrix works on the same data array as mat, so changes are seen on the other one respectively.

Parameters:
mat - the parent matrix
beginRow - the row to start this matrix at
beginCol - the column to start this matrix at
Returns:
the new shared submatrix
See Also:
#Matrix3f(int, int, float[])

fromPool

public static Matrix3f fromPool()
Allocates an Matrix3f instance from the pool.


toPool

public static void toPool(Matrix3f o)
Stores the given Matrix3f instance in the pool.

Parameters:
o -