Package com.jme3.math
Class Matrix4f
java.lang.Object
com.jme3.math.Matrix4f
- All Implemented Interfaces:
Savable
,Serializable
,Cloneable
A 4x4 matrix composed of 16 single-precision elements, used to represent
linear or perspective transformations of 3-D coordinates.
The rightmost column (column 3) stores the translation vector. Element numbering is (row,column), so m03 is the row 0, column 3, which is the X translation.
Methods with names ending in "Local" modify the current instance. They are used to avoid creating garbage.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Matrix4f
an instance of the identity matrix (diagonals = 1, other elements = 0)float
The element in row 0, column 0.float
The element in row 0, column 1.float
The element in row 0, column 2.float
The element in row 0, column 3 (the X translation).float
The element in row 1, column 0.float
The element in row 1, column 1.float
The element in row 1, column 2.float
The element in row 1, column 3 (the Y translation).float
The element in row 2, column 0.float
The element in row 2, column 1.float
The element in row 2, column 2.float
The element in row 2, column 3 (the Z translation).float
The element in row 3, column 0.float
The element in row 3, column 1.float
The element in row 3, column 2.float
The element in row 3, column 3.static final Matrix4f
an instance of the zero matrix (all elements = 0) -
Constructor Summary
ConstructorDescriptionMatrix4f()
Instantiates an identity matrix (diagonals = 1, other elements = 0).Matrix4f
(float[] array) Create aMatrix4f
from the specified array.Matrix4f
(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) Create aMatrix4f
with the specified element values.Create aMatrix4f
that duplicates the specified matrix. -
Method Summary
Modifier and TypeMethodDescriptionAdd the specified matrix.void
Sum in place, with the specified matrix.adjoint()
Generate the adjoint.Generate the adjoint.void
angleRotation
(Vector3f angles) Load a rotation around three axes (x, y, z).clone()
Creates a copy.void
Copy all elements of the specified matrix to this matrix.float
Calculate the determinant.boolean
Tests for exact equality with the argument, distinguishing -0 from 0.void
fillFloatArray
(float[] f, boolean columnMajor) Copy all elements to a float array.Copy all elements to an existing FloatBuffer, starting at its current position, in row-major order.fillFloatBuffer
(FloatBuffer fb, boolean columnMajor) Copy all elements to an existing FloatBuffer, starting at its current position.void
fromAngleAxis
(float angle, Vector3f axis) Load a 3-D rotation specified by an angle and axis.void
fromAngleNormalAxis
(float angle, Vector3f axis) Load a 3-D rotation specified by an angle and axis.void
void
fromFrustum
(float near, float far, float left, float right, float top, float bottom, boolean parallel) Load a perspective-view transform with the specified clipping planes.void
get
(float[] matrix) Copy all elements to a float array, in row-major order.void
get
(float[] matrix, boolean rowMajor) Copy all elements to a float array.float
get
(int i, int j) Retrieve the element at the specified position.float[]
getColumn
(int i) Copy the specified column to a new float array.float[]
getColumn
(int i, float[] store) Copy the specified column to a float array.int
hashCode()
Returns a hash code.void
Inverse rotate the specified Vector3f using the rotation component of this 3-D coordinate transform.void
inverseTranslateVect
(float[] vec) Inverse translate the specified vector using the translation component of this 3-D coordinate transform.void
inverseTranslateVect
(Vector3f data) Inverse translate the specified Vector3f using the translation component of this 3-D coordinate transform.invert()
Generate the inverse.Generate the inverse.Inverts in place.boolean
Test for exact identity.boolean
Tests for approximate equality with the specified matrix, using the specified tolerance.void
Configures as an identity matrix (diagonals = 1, other elements = 0).mult
(float scalar) Multiply by the specified scalar.float[]
mult
(float[] vec4f) Multiply the specified float array by this matrix.Multiply by the specified scalar.Right-multiply by the specified matrix.Right-multiply by the specified matrix.mult
(Quaternion vec, Quaternion store) Multiply the specified Quaternion by this matrix.Apply this 3-D coordinate transform to the specified Vector3f.Apply this 3-D coordinate transform to the specified Vector3f.Multiply the specified Vector4f by this matrix.Multiply the specified Vector4f by this matrix.float[]
multAcross
(float[] vec4f) Multiply the specified float array by the transform of this matrix.multAcross
(Vector3f vec, Vector3f store) Apply the transform of this 3-D coordinate transform to the specified Vector3f.multAcross
(Vector4f vec) Multiply the specified Vector4f by the transform of this matrix.multAcross
(Vector4f vec, Vector4f store) Multiply the specified Vector4f by the transform of this matrix.void
multLocal
(float scalar) Multiplies in place by the scalar argument.Right-multiply in place, by the specified matrix.void
multLocal
(Quaternion rotation) multNormal
(Vector3f vec, Vector3f store) Rotate and scale the specified vector, but don't translate it.multNormalAcross
(Vector3f vec, Vector3f store) Rotate and scale the specified vector by the transpose, but don't translate it.float
Apply this perspective transform to the specified Vector3f.void
read
(JmeImporter importer) De-serialize from the specified importer, for example when loading from a J3O file.Load from the specified FloatBuffer, in row-major order.readFloatBuffer
(FloatBuffer fb, boolean columnMajor) Load from the specified FloatBuffer.void
rotateVect
(Vector3f vec) Rotate the specified Vector3f using the rotation component of this 3-D coordinate transform.void
Scale by the specified Vector3f.void
set
(float[] matrix) Load all elements from the specified array.void
set
(float[][] matrix) Load all elements from the specified 4x4 array.void
set
(float[] matrix, boolean rowMajor) Load all elements from the specified array.void
set
(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) Load the specified element values.void
set
(int i, int j, float value) Store the specified value at the specified position.Copy all elements of the specified matrix to this matrix.void
setColumn
(int i, float[] column) Load the specified column from the specified array.void
setInverseRotationDegrees
(float[] angles) Load an inverted rotation from Euler angles in degrees.void
setInverseRotationRadians
(float[] angles) Load an inverted rotation from Euler angles in radians.void
setInverseTranslation
(float[] translation) Alter the inverse-translation component of this 3-D coordinate transform.void
Load a rotation from aQuaternion
.void
setScale
(float x, float y, float z) Alters the scale component of the coordinate transform.void
Alters the scale component of the coordinate transform.void
setTransform
(Vector3f position, Vector3f scale, Matrix3f rotMat) Load with the specified coordinate transform.void
setTranslation
(float[] translation) Alter the translation component of this 3-D coordinate transform.void
setTranslation
(float x, float y, float z) Alter the translation component of this 3-D coordinate transform.void
setTranslation
(Vector3f translation) Alters the translation component of the coordinate transform.Copy all elements to a new, direct FloatBuffer.toFloatBuffer
(boolean columnMajor) Copy all elements to a new, direct FloatBuffer.Determine the rotation component of this 3-D coordinate transform.void
toRotationMatrix
(Matrix3f mat) Determines the rotation component of the coordinate transform.Determine the rotation component of this 3-D coordinate transform.Returns the rotation component of the coordinate transform.Determine the scale component of this 3-D coordinate transform.toScaleVector
(Vector3f store) Determines the scale component of the coordinate transform.toString()
Returns a string representation of the matrix, which is unaffected.Determine the translation component of this 3-D coordinate transform.toTranslationVector
(Vector3f vector) Returns the translation component of the coordinate transform.void
translateVect
(Vector3f data) Translate the specified Vector3f using the translation component of this 3-D coordinate transform.Generate the transpose.Transpose in place.void
write
(JmeExporter e) Serialize to the specified exporter, for example when saving to a J3O file.zero()
Sets all elements to zero.
-
Field Details
-
m00
public float m00The element in row 0, column 0. -
m01
public float m01The element in row 0, column 1. -
m02
public float m02The element in row 0, column 2. -
m03
public float m03The element in row 0, column 3 (the X translation). -
m10
public float m10The element in row 1, column 0. -
m11
public float m11The element in row 1, column 1. -
m12
public float m12The element in row 1, column 2. -
m13
public float m13The element in row 1, column 3 (the Y translation). -
m20
public float m20The element in row 2, column 0. -
m21
public float m21The element in row 2, column 1. -
m22
public float m22The element in row 2, column 2. -
m23
public float m23The element in row 2, column 3 (the Z translation). -
m30
public float m30The element in row 3, column 0. -
m31
public float m31The element in row 3, column 1. -
m32
public float m32The element in row 3, column 2. -
m33
public float m33The element in row 3, column 3. -
ZERO
an instance of the zero matrix (all elements = 0) -
IDENTITY
an instance of the identity matrix (diagonals = 1, other elements = 0)
-
-
Constructor Details
-
Matrix4f
public Matrix4f()Instantiates an identity matrix (diagonals = 1, other elements = 0). -
Matrix4f
public Matrix4f(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) Create aMatrix4f
with the specified element values.- Parameters:
m00
- the desired value for row 0, column 0m01
- the desired value for row 0, column 1m02
- the desired value for row 0, column 2m03
- the desired value for row 0, column 3m10
- the desired value for row 1, column 0m11
- the desired value for row 1, column 1m12
- the desired value for row 1, column 2m13
- the desired value for row 1, column 3m20
- the desired value for row 2, column 0m21
- the desired value for row 2, column 1m22
- the desired value for row 2, column 2m23
- the desired value for row 2, column 3m30
- the desired value for row 3, column 0m31
- the desired value for row 3, column 1m32
- the desired value for row 3, column 2m33
- the desired value for row 3, column 3
-
Matrix4f
public Matrix4f(float[] array) Create aMatrix4f
from the specified array.- Parameters:
array
- the source array: 16 floats in column-major order (translation in elements 12, 13, and 14)
-
Matrix4f
Create aMatrix4f
that duplicates the specified matrix. If null is specified, the new matrix is initialized to identity (diagonals = 1, other elements = 0).- Parameters:
mat
- the source matrix (unaffected, may be null)
-
-
Method Details
-
copy
Copy all elements of the specified matrix to this matrix. If null is specified, load identity (diagonals = 1, other elements = 0).- Parameters:
matrix
- the source matrix (may be null, unaffected)
-
fromFrame
-
get
public void get(float[] matrix) Copy all elements to a float array, in row-major order.- Parameters:
matrix
- the destination array (not null, length=16)
-
get
public void get(float[] matrix, boolean rowMajor) Copy all elements to a float array.- Parameters:
matrix
- the destination array (not null, length=16)rowMajor
- true to store in row-major order, false to store in column-major order
-
get
public float get(int i, int j) Retrieve the element at the specified position.- Parameters:
i
- the row index of the element to retrieve (0, 1, 2, or 3)j
- the column index of the element to retrieve (0, 1, 2, or 3)- Returns:
- the value at (i, j)
- Throws:
IllegalArgumentException
- if either index is invalid.
-
getColumn
public float[] getColumn(int i) Copy the specified column to a new float array.- Parameters:
i
- the index of the column to copy (0, 1, 2, or 3)- Returns:
- a new array with length=4
-
getColumn
public float[] getColumn(int i, float[] store) Copy the specified column to a float array.- Parameters:
i
- the index of the column to copy (0, 1, 2, or 3)store
- storage for the result (modified) or null to create a new array- Returns:
- either store or a new array with length=4
-
setColumn
public void setColumn(int i, float[] column) Load the specified column from the specified array.- Parameters:
i
- the index of the column to fill (0, 1, 2, or 3)column
- the source array (unaffected) or null
-
set
public void set(int i, int j, float value) Store the specified value at the specified position.- Parameters:
i
- the row index of the element to set (0, 1, 2, or 3)j
- the column index of the element to set (0, 1, 2, or 3)value
- the value for element (i, j)- Throws:
IllegalArgumentException
- if either index is invalid.
-
set
public void set(float[][] matrix) Load all elements from the specified 4x4 array.- Parameters:
matrix
- the source array (not null, unaffected)- Throws:
IllegalArgumentException
- if the source array isn't 4x4.
-
set
public void set(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) Load the specified element values.- Parameters:
m00
- the desired value for row 0, column 0m01
- the desired value for row 0, column 1m02
- the desired value for row 0, column 2m03
- the desired value for row 0, column 3m10
- the desired value for row 1, column 0m11
- the desired value for row 1, column 1m12
- the desired value for row 1, column 2m13
- the desired value for row 1, column 3m20
- the desired value for row 2, column 0m21
- the desired value for row 2, column 1m22
- the desired value for row 2, column 2m23
- the desired value for row 2, column 3m30
- the desired value for row 3, column 0m31
- the desired value for row 3, column 1m32
- the desired value for row 3, column 2m33
- the desired value for row 3, column 3
-
set
Copy all elements of the specified matrix to this matrix.- Parameters:
matrix
- the source matrix (not null, unaffected)- Returns:
- this (modified)
-
set
public void set(float[] matrix) Load all elements from the specified array.- Parameters:
matrix
- the source array, in row-major order (not null, length=16, unaffected)
-
set
public void set(float[] matrix, boolean rowMajor) Load all elements from the specified array.- Parameters:
matrix
- the source array (not null, length=16, unaffected)rowMajor
- true if the source array is in row-major order, false if it's in column-major order
-
transpose
Generate the transpose.- Returns:
- a new Matrix4f with the rows and columns transposed
-
transposeLocal
Transpose in place.- Returns:
- this (transposed)
-
toFloatBuffer
Copy all elements to a new, direct FloatBuffer.- Returns:
- a rewound buffer containing all 16 element values in row-major order
-
toFloatBuffer
Copy all elements to a new, direct FloatBuffer.- Parameters:
columnMajor
- true to store in column-major order, false to store in row-major order- Returns:
- a rewound buffer containing all 16 element values
-
fillFloatBuffer
Copy all elements to an existing FloatBuffer, starting at its current position, in row-major order.- Parameters:
fb
- the destination buffer (not null, must have space remaining for 16 floats)- Returns:
- the destination buffer, its position advanced by 16
-
fillFloatBuffer
Copy all elements to an existing FloatBuffer, starting at its current position.- Parameters:
fb
- the destination buffer (not null, must have space remaining for 16 floats)columnMajor
- true to store in column-major order, false to store in row-major order- Returns:
- the destination buffer, its position advanced by 16
-
fillFloatArray
public void fillFloatArray(float[] f, boolean columnMajor) Copy all elements to a float array.- Parameters:
f
- the destination array (not null, length≥16, modified)columnMajor
- true → column-major order, false → row-major order
-
readFloatBuffer
Load from the specified FloatBuffer, in row-major order.- Parameters:
fb
- the source buffer, must have 16 floats remaining to get- Returns:
- this (modified)
-
readFloatBuffer
Load from the specified FloatBuffer.- Parameters:
fb
- the source buffer, must have 16 floats remaining to getcolumnMajor
- if true, the buffer contains column-major data, otherwise it contains row-major data.- Returns:
- this (modified)
-
loadIdentity
public void loadIdentity()Configures as an identity matrix (diagonals = 1, other elements = 0). -
fromFrustum
public void fromFrustum(float near, float far, float left, float right, float top, float bottom, boolean parallel) Load a perspective-view transform with the specified clipping planes.- Parameters:
near
- the coordinate of the near planefar
- the coordinate of the far planeleft
- the coordinate of the left planeright
- the coordinate of the right planetop
- the coordinate of the top planebottom
- the coordinate of the bottom planeparallel
- true → parallel sides, false → perspective
-
fromAngleAxis
Load a 3-D rotation specified by an angle and axis. If the axis is already normalized, usefromAngleNormalAxis(float, com.jme3.math.Vector3f)
instead because it's more efficient.- Parameters:
angle
- the angle to rotate (in radians)axis
- the axis of rotation (not null)
-
fromAngleNormalAxis
Load a 3-D rotation specified by an angle and axis. Assumes the axis is already normalized.- Parameters:
angle
- the angle to rotate (in radians)axis
- the axis of rotation (not null, already normalized)
-
multLocal
public void multLocal(float scalar) Multiplies in place by the scalar argument.- Parameters:
scalar
- the scaling factor to apply to all elements
-
mult
Multiply by the specified scalar.- Parameters:
scalar
- the scale factor to apply to all elements- Returns:
- a new Matrix4f with every element scaled
-
mult
Multiply by the specified scalar.- Parameters:
scalar
- the scale factor to apply to all elementsstore
- storage for the result (modified) or null to create a new matrix- Returns:
- a scaled matrix (either store or a new instance)
-
mult
Right-multiply by the specified matrix. (This matrix is the left factor.)- Parameters:
in2
- the right factor (not null, unaffected)- Returns:
- the product, this times in2 (a new instance)
-
mult
Right-multiply by the specified matrix. (This matrix is the left factor.)- Parameters:
in2
- the right factor (not null)store
- storage for the result (modified) or null to create a new matrix. It is safe for in2 and store to be the same object.- Returns:
- the product, this times in2 (either store or a new instance)
-
multLocal
Right-multiply in place, by the specified matrix. (This matrix is the left factor.)- Parameters:
in2
- the right factor (not null)- Returns:
- this (modified)
-
mult
Apply this 3-D coordinate transform to the specified Vector3f.- Parameters:
vec
- the vector to transform (not null)- Returns:
- a new vector
-
mult
Apply this 3-D coordinate transform to the specified Vector3f.- Parameters:
vec
- the vector to transform (not null)store
- storage for the result (modified) or null to create a new vector- Returns:
- the transformed vector (either store or a new vector)
-
mult
Multiply the specified Vector4f by this matrix.- Parameters:
vec
- the vector to multiply (unaffected) or null- Returns:
- a new vector or null
-
mult
Multiply the specified Vector4f by this matrix.- Parameters:
vec
- the vector to multiply (unaffected) or nullstore
- storage for the result (modified) or null to create a new vector- Returns:
- the product (either store or a new vector) or null
-
multAcross
Multiply the specified Vector4f by the transform of this matrix.- Parameters:
vec
- the vector to multiply (unaffected) or null- Returns:
- a new vector or null
-
multAcross
Multiply the specified Vector4f by the transform of this matrix.- Parameters:
vec
- the vector to multiply (unaffected) or nullstore
- storage for the result (modified) or null to create a new vector- Returns:
- the product (either store or a new vector) or null
-
multNormal
Rotate and scale the specified vector, but don't translate it.- Parameters:
vec
- the vector to transform (not null, unaffected)store
- storage for the result (modified) or null to create a new vector- Returns:
- the transformed vector (either store or a new vector)
-
multNormalAcross
Rotate and scale the specified vector by the transpose, but don't translate it.- Parameters:
vec
- the vector to transform (not null, unaffected)store
- storage for the result (modified) or null to create a new vector- Returns:
- the transformed vector (either store or a new vector)
-
multProj
Apply this perspective transform to the specified Vector3f. Return the W value, calculated by dotting the vector with the last row.- Parameters:
vec
- the vector to transform (not null, unaffected)store
- storage for the result (not null, modified)- Returns:
- the W value
-
multAcross
Apply the transform of this 3-D coordinate transform to the specified Vector3f.- Parameters:
vec
- the vector to transform (unaffected) or nullstore
- storage for the result (modified) or null to create a new vector- Returns:
- the transformed vector (either store or a new vector) or null
-
mult
Multiply the specified Quaternion by this matrix.- Parameters:
vec
- the Quaternion to multiply (unaffected) or nullstore
- storage for the result (modified) or null to create a new Quaternion- Returns:
- the product (either store or a new Quaternion) or null
-
mult
public float[] mult(float[] vec4f) Multiply the specified float array by this matrix.- Parameters:
vec4f
- the array to multiply or null- Returns:
- vec4f (modified) or null
-
multAcross
public float[] multAcross(float[] vec4f) Multiply the specified float array by the transform of this matrix.- Parameters:
vec4f
- the array to multiply or null- Returns:
- vec4f (modified) or null
-
invert
Generate the inverse.- Returns:
- a new instance
-
invert
Generate the inverse.- Parameters:
store
- storage for the result (modified) or null to create a new matrix- Returns:
- either store or a new instance
- Throws:
ArithmeticException
- if cannot be inverted
-
invertLocal
Inverts in place. If the current instance is singular, the matrix is zeroed.- Returns:
- the (inverted) current instance (for chaining)
-
adjoint
Generate the adjoint.- Returns:
- a new instance
-
setTransform
Load with the specified coordinate transform. The effective sequence of operations is: scale, then rotate, then translate.- Parameters:
position
- the desired translation (not null, unaffected)scale
- the desired scale factors (not null, unaffected)rotMat
- the desired rotation (not null, unaffected)
-
adjoint
Generate the adjoint.- Parameters:
store
- storage for the result (modified) or null to create a new matrix- Returns:
- either store or a new instance
-
determinant
public float determinant()Calculate the determinant.- Returns:
- the determinant
-
zero
Sets all elements to zero.- Returns:
- the (modified) current instance (for chaining)
-
add
Add the specified matrix.- Parameters:
mat
- the matrix to add (not null)- Returns:
- the sum (a new instance)
-
addLocal
Sum in place, with the specified matrix.- Parameters:
mat
- the matrix to add (not null)
-
toTranslationVector
Determine the translation component of this 3-D coordinate transform.- Returns:
- a new translation vector
-
toTranslationVector
Returns the translation component of the coordinate transform.- Parameters:
vector
- storage for the result (not null, modified)- Returns:
- the translation component (in
vector
) for chaining
-
toRotationQuat
Determine the rotation component of this 3-D coordinate transform.- Returns:
- a new rotation Quaternion
-
toRotationQuat
Returns the rotation component of the coordinate transform.- Parameters:
q
- storage for the result (not null, modified)- Returns:
- the rotation component (in
q
) for chaining
-
toRotationMatrix
Determine the rotation component of this 3-D coordinate transform.- Returns:
- a new rotation Matrix3f
-
toRotationMatrix
Determines the rotation component of the coordinate transform.- Parameters:
mat
- storage for the result (not null, modified)
-
toScaleVector
Determine the scale component of this 3-D coordinate transform.- Returns:
- a new Vector3f
-
toScaleVector
Determines the scale component of the coordinate transform.- Parameters:
store
- storage for the result (not null, modified)- Returns:
- the scale factors (in
store
) for chaining
-
setScale
public void setScale(float x, float y, float z) Alters the scale component of the coordinate transform.- Parameters:
x
- the desired scale factor for the X axisy
- the desired scale factor for the Y axisz
- the desired scale factor for the Z axis
-
setScale
Alters the scale component of the coordinate transform.- Parameters:
scale
- the desired scale factors (not null, unaffected)
-
setTranslation
public void setTranslation(float[] translation) Alter the translation component of this 3-D coordinate transform.- Parameters:
translation
- the desired translation (not null, length=3, unaffected)- Throws:
IllegalArgumentException
- if translation doesn't have length=3.
-
setTranslation
public void setTranslation(float x, float y, float z) Alter the translation component of this 3-D coordinate transform.- Parameters:
x
- the desired X-axis offsety
- the desired Y-axis offsetz
- the desired Z-axis offset
-
setTranslation
Alters the translation component of the coordinate transform.- Parameters:
translation
- the desired translation (not null, unaffected)
-
setInverseTranslation
public void setInverseTranslation(float[] translation) Alter the inverse-translation component of this 3-D coordinate transform.- Parameters:
translation
- the desired inverse translation (not null, length=3, unaffected)- Throws:
IllegalArgumentException
- if translation doesn't have length=3.
-
angleRotation
Load a rotation around three axes (x, y, z). Where each axis has a specified rotation in degrees. These rotations are expressed in a singleVector3f
object.- Parameters:
angles
- the desired rotation angles for each axis (in degrees)
-
setRotationQuaternion
Load a rotation from aQuaternion
.- Parameters:
quat
- the desired rotation (not null, unaffected)- Throws:
NullPointerException
- if quat is null.
-
setInverseRotationRadians
public void setInverseRotationRadians(float[] angles) Load an inverted rotation from Euler angles in radians.- Parameters:
angles
- the desired Euler angles (in radians, not null, length=3)- Throws:
IllegalArgumentException
- if angles doesn't have length=3.
-
setInverseRotationDegrees
public void setInverseRotationDegrees(float[] angles) Load an inverted rotation from Euler angles in degrees.- Parameters:
angles
- the desired Euler angles (in degrees, not null, length=3)- Throws:
IllegalArgumentException
- if angles doesn't have length=3.
-
inverseTranslateVect
public void inverseTranslateVect(float[] vec) Inverse translate the specified vector using the translation component of this 3-D coordinate transform.- Parameters:
vec
- the vector to translate (not null, length=3, modified)- Throws:
IllegalArgumentException
- if vec doesn't have length=3.
-
inverseTranslateVect
Inverse translate the specified Vector3f using the translation component of this 3-D coordinate transform.- Parameters:
data
- the Vector3f to translate (not null, modified)
-
translateVect
Translate the specified Vector3f using the translation component of this 3-D coordinate transform.- Parameters:
data
- the Vector3f to translate (not null, modified)
-
inverseRotateVect
Inverse rotate the specified Vector3f using the rotation component of this 3-D coordinate transform.- Parameters:
vec
- the Vector3f to inverse rotate (not null, modified)
-
rotateVect
Rotate the specified Vector3f using the rotation component of this 3-D coordinate transform.- Parameters:
vec
- the Vector3f to rotate (not null, modified)
-
toString
Returns a string representation of the matrix, which is unaffected. For example, the identity matrix is represented by:Matrix4f [ 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 ]
-
hashCode
public int hashCode()Returns a hash code. If two matrices have identical values, they will have the same hash code. The matrix is unaffected. -
equals
Tests for exact equality with the argument, distinguishing -0 from 0. Ifo
is null, false is returned. Either way, the current instance is unaffected. -
write
Serialize to the specified exporter, for example when saving to a J3O file.- Specified by:
write
in interfaceSavable
- Parameters:
e
- (not null)- Throws:
IOException
- from the exporter
-
read
De-serialize from the specified importer, for example when loading from a J3O file.- Specified by:
read
in interfaceSavable
- Parameters:
importer
- (not null)- Throws:
IOException
- from the importer
-
isIdentity
public boolean isIdentity()Test for exact identity.- Returns:
- true if this is an exact identity, otherwise false
-
scale
Scale by the specified Vector3f.- Parameters:
scale
- the scale factors to apply
-
multLocal
-
isSimilar
Tests for approximate equality with the specified matrix, using the specified tolerance. Ifother
is null, false is returned. Either way, the current instance is unaffected.- Parameters:
other
- the matrix to compare (unaffected) or null for noneepsilon
- the tolerance for each element- Returns:
- true if all 16 elements are within tolerance, otherwise false
-
clone
Creates a copy. The current instance is unaffected.
-