public final class Matrix4f extends Object implements Cloneable, Serializable, org.synthclipse.core.ICopyable<Matrix4f>
Matrix4f
defines and maintains a 4x4 matrix in row major order.
This matrix is intended for use in a translation and rotational capacity. It
provides convenience methods for creating the matrix from a multitude of
sources.
Matrices are stored assuming column vectors on the right, with the
translation in the rightmost column. Element numbering is row,column, so m03
is the zeroth row, third column, which is the "x" translation part. This
means that the implicit storage order is column major. However, the get() and
set() functions on float arrays default to row major order!
Matrix4f
instance can be created by
Native.newMatrix4()
/
Native.newMatrix4(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33)
.
Modifier and Type | Field and Description |
---|---|
static Matrix4f |
IDENTITY |
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 |
static Matrix4f |
ZERO |
Constructor and Description |
---|
Matrix4f()
Constructor instantiates a new
Matrix that is set to the
identity matrix. |
Matrix4f(float[] array)
Create a new Matrix4f, given data in column-major format.
|
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)
constructs a matrix with the given values.
|
Matrix4f(Matrix4f mat)
Constructor instantiates a new
Matrix that is set to the
provided matrix. |
Modifier and Type | Method and Description |
---|---|
Matrix4f |
add(Matrix4f mat) |
void |
addLocal(Matrix4f mat)
add adds the values of a parameter matrix to this matrix. |
Matrix4f |
adjoint()
Returns a new matrix representing the adjoint of this matrix.
|
Matrix4f |
adjoint(Matrix4f store)
Places the adjoint of this matrix in store (creates store if null.)
|
void |
angleRotation(Vector3f angles)
angleRotation sets this matrix to that of a rotation about
three axes (x, y, z). |
Matrix4f |
clone() |
Matrix4f |
copy() |
void |
copy(Matrix4f matrix)
copy transfers the contents of a given matrix to this
matrix. |
float |
determinant()
determinant generates the determinate of this matrix. |
boolean |
equals(Object o)
are these two matrices the same? they are is they both have the same mXX
values.
|
void |
fillFloatArray(float[] f,
boolean columnMajor) |
FloatBuffer |
fillFloatBuffer(FloatBuffer fb)
fillFloatBuffer fills a FloatBuffer object with the matrix
data. |
FloatBuffer |
fillFloatBuffer(FloatBuffer fb,
boolean columnMajor)
fillFloatBuffer fills a FloatBuffer object with the matrix
data. |
void |
fromAngleAxis(float angle,
float axis_x,
float axis_y,
float axis_z) |
void |
fromAngleAxis(float angle,
Vector3f axis)
fromAngleAxis sets this matrix4f to the values specified by
an angle and an axis of rotation. |
void |
fromAngleNormalAxis(float angle,
float axis_x,
float axis_y,
float axis_z)
fromAngleNormalAxis sets this matrix4f to the values
specified by an angle and a normalized axis of rotation. |
void |
fromAngleNormalAxis(float angle,
Vector3f axis)
fromAngleNormalAxis sets this matrix4f to the values
specified by an angle and a normalized axis of rotation. |
void |
fromFrame(Vector3f location,
Vector3f direction,
Vector3f up,
Vector3f left) |
void |
fromFrustum(float near,
float far,
float left,
float right,
float top,
float bottom,
boolean parallel) |
void |
fromTwoVectors(float a_x,
float a_y,
float a_z,
float b_x,
float b_y,
float b_z)
Creates rotation matrix corresponding to rotation between two vectors.
|
void |
fromTwoVectors(Vector3f a,
Vector3f b)
Creates rotation matrix corresponding to rotation between two vectors.
|
void |
get(float[] matrix)
get retrieves the values of this object into a float array
in row-major order. |
void |
get(float[] matrix,
boolean rowMajor)
set retrieves the values of this object into a float array. |
float |
get(int i,
int j)
get retrieves a value from the matrix at the given position. |
float[] |
getColumn(int i)
getColumn returns one of three columns specified by the
parameter. |
float[] |
getColumn(int i,
float[] store)
getColumn returns one of three columns specified by the
parameter. |
Vector3f |
getEulerAngles()
Gets Euler angles from rotation matrix.
|
void |
getEulerAngles(Vector3f result)
Gets Euler angles from rotation matrix.
|
int |
hashCode()
hashCode returns the hash code value as an integer and is
supported for the benefit of hashing based collection classes such as
Hashtable, HashMap, HashSet etc. |
Matrix4f |
identity()
Sets this matrix to the identity matrix, namely
all zeros with ones along the diagonal.
|
void |
inverseRotateVect(Vector3f vec)
inverseRotateVect rotates a given Vector3f by the rotation
part of this matrix. |
void |
inverseTranslateVect(float[] vec)
inverseTranslateVect translates a given Vector3f by the
translation part of this matrix. |
void |
inverseTranslateVect(Vector3f data)
inverseTranslateVect translates a given Vector3f by the
translation part of this matrix. |
Matrix4f |
invert()
Inverts this matrix as a new Matrix4f.
|
Matrix4f |
invert(Matrix4f store)
Inverts this matrix and stores it in the given store.
|
Matrix4f |
invertLocal()
Inverts this matrix locally.
|
boolean |
isIdentity() |
void |
loadIdentity()
loadIdentity sets this matrix to the identity matrix, namely
all zeros with ones along the diagonal. |
void |
lookAt(Vector3f eye,
Vector3f center,
Vector3f up) |
void |
lookAtDirection(Vector3f eye,
Vector3f dir,
Vector3f up) |
Matrix4f |
mult(float scalar) |
float[] |
mult(float[] vec4f)
mult multiplies an array of 4 floats against this rotation
matrix. |
Matrix4f |
mult(float scalar,
Matrix4f store) |
Matrix4f |
mult(Matrix4f in2)
mult multiplies this matrix with another matrix. |
Matrix4f |
mult(Matrix4f in2,
Matrix4f store)
mult multiplies this matrix with another matrix. |
Quaternion |
mult(Quaternion vec,
Quaternion store)
mult multiplies a quaternion about a matrix. |
Vector3f |
mult(Vector3f vec)
mult multiplies a vector about a rotation matrix. |
Vector3f |
mult(Vector3f vec,
Vector3f store)
mult multiplies a vector about a rotation matrix and adds
translation. |
Vector4f |
mult(Vector4f vec)
mult multiplies a Vector4f about a rotation
matrix. |
Vector4f |
mult(Vector4f vec,
Vector4f store)
mult multiplies a Vector4f about a rotation
matrix. |
float[] |
multAcross(float[] vec4f)
mult multiplies an array of 4 floats against this rotation
matrix. |
Vector3f |
multAcross(Vector3f vec,
Vector3f store)
mult multiplies a vector about a rotation matrix. |
Vector4f |
multAcross(Vector4f vec)
mult multiplies a vector about a rotation matrix. |
Vector4f |
multAcross(Vector4f vec,
Vector4f store)
mult multiplies a vector about a rotation matrix. |
void |
multLocal(float scalar)
mult multiplies this matrix by a scalar. |
Matrix4f |
multLocal(Matrix4f in2)
mult multiplies this matrix with another matrix. |
void |
multLocal(Quaternion rotation) |
Vector3f |
multNormal(Vector3f vec,
Vector3f store)
multNormal multiplies a vector about a rotation matrix, but
does not add translation. |
Vector3f |
multNormalAcross(Vector3f vec,
Vector3f store)
multNormal multiplies a vector about a rotation matrix, but
does not add translation. |
float |
multProj(Vector3f vec,
Vector3f store)
mult multiplies a vector about a rotation matrix and adds
translation. |
void |
orthonormalize()
Ortho-normalize rotation matrix.
|
void |
perspective(float fovy,
float aspect,
float zNear,
float zFar) |
Matrix4f |
readFloatBuffer(FloatBuffer fb)
readFloatBuffer reads value for this matrix from a
FloatBuffer. |
Matrix4f |
readFloatBuffer(FloatBuffer fb,
boolean columnMajor)
readFloatBuffer reads value for this matrix from a
FloatBuffer. |
Matrix4f |
rotate(float pitch,
float yaw,
float roll)
This method effectively does:
Matrix4f rot = new Matrix4f();
but without any object creation. |
Matrix4f |
rotate(Vector3f pitchYawRoll)
Same as
rotate(float, float, float) but the arguments are wrapped in a vector. |
Matrix4f |
rotateAxis(float angle,
float axis_x,
float axis_y,
float axis_z)
This method effectively does:
Matrix4f rot = new Matrix4f();
but without any object creation. |
Matrix4f |
rotateAxis(float angle,
Vector3f axis)
Same as
rotateAxis(float, float, float, float) but axis' components are wrapped in a vector. |
Matrix4f |
rotateAxisDeg(float angle,
float axis_x,
float axis_y,
float axis_z)
Same as
rotateAxis(float, float, float, float) but using degrees instead of radians. |
Matrix4f |
rotateAxisDeg(float angle,
Vector3f axis)
Same as
rotateAxisDeg(float, float, float, float) but axis' components are wrapped in a vector. |
Matrix4f |
rotateDeg(float pitch,
float yaw,
float roll)
Same as
rotate(float, float, float) but using degrees instead of radians. |
Matrix4f |
rotateDeg(Vector3f pitchYawRoll)
Same as
rotateDeg(float, float, float) but the arguments are wrapped in a vector. |
void |
rotateVect(Vector3f vec) |
Matrix4f |
scale(float s)
This method effectively does:
Matrix4f scale = new Matrix4f();
but without any object creation. |
Matrix4f |
scale(float x,
float y,
float z)
This method effectively does:
Matrix4f scale = new Matrix4f();
but without any object creation. |
Matrix4f |
scale(Vector3f scaleVec)
Same as
scale(float, float, float) but arguments are wrapped in a vector. |
void |
set(float[] matrix)
set sets the values of this matrix from an array of values
assuming that the data is rowMajor order; |
void |
set(float[][] matrix)
set sets the values of this matrix from an array of values. |
void |
set(float[] matrix,
boolean rowMajor)
set sets the values of this matrix from an array of values; |
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)
Sets the values of this matrix
|
void |
set(int i,
int j,
float value)
set places a given value into the matrix at the given
position. |
Matrix4f |
set(Matrix4f matrix)
set sets the values of this matrix from another matrix. |
void |
setColumn(int i,
float[] column)
setColumn sets a particular column of this matrix to that
represented by the provided vector. |
void |
setInverseRotationDegrees(float[] angles)
setInverseRotationDegrees builds an inverted rotation from
Euler angles that are in degrees. |
void |
setInverseRotationRadians(float[] angles)
setInverseRotationRadians builds an inverted rotation from
Euler angles that are in radians. |
void |
setInverseTranslation(float[] translation)
setInverseTranslation will set the matrix's inverse
translation values. |
void |
setRotationQuaternion(Quaternion quat)
setRotationQuaternion builds a rotation from a
Quaternion . |
void |
setScale(float x,
float y,
float z) |
void |
setScale(Vector3f scale) |
void |
setTransform(Vector3f position,
Vector3f scale,
Matrix3f rotMat) |
void |
setTranslation(float[] translation)
setTranslation will set the matrix's translation values. |
void |
setTranslation(float x,
float y,
float z)
setTranslation will set the matrix's translation values. |
void |
setTranslation(Vector3f translation)
setTranslation will set the matrix's translation values. |
FloatBuffer |
toFloatBuffer()
toFloatBuffer returns a FloatBuffer object that contains the
matrix data. |
FloatBuffer |
toFloatBuffer(boolean columnMajor)
toFloatBuffer returns a FloatBuffer object that contains the
matrix data. |
Matrix3f |
toRotationMatrix() |
void |
toRotationMatrix(Matrix3f mat) |
Quaternion |
toRotationQuat() |
void |
toRotationQuat(Quaternion q) |
Vector3f |
toScaleVector()
Retreives the scale vector from the matrix.
|
void |
toScaleVector(Vector3f vector)
Retreives the scale vector from the matrix and stores it into a given
vector.
|
String |
toString()
toString returns the string representation of this object. |
Vector3f |
toTranslationVector() |
void |
toTranslationVector(Vector3f vector) |
Matrix4f |
translate(float x,
float y,
float z)
This method effectively does:
Matrix4f trans = new Matrix4f();
but without any object creation. |
Matrix4f |
translate(Vector3f trans)
Same as
translate(float, float, float) but the arguments are wrapped in a vector. |
void |
translateVect(Vector3f data)
inverseTranslateVect translates a given Vector3f by the
translation part of this matrix. |
Matrix4f |
transpose() |
Matrix4f |
transposeLocal()
transpose locally transposes this Matrix. |
void |
yawPitchRoll(float yaw,
float pitch,
float roll) |
Matrix4f |
zero()
Sets all of the values in this matrix to zero.
|
public float m00
public float m01
public float m02
public float m03
public float m10
public float m11
public float m12
public float m13
public float m20
public float m21
public float m22
public float m23
public float m30
public float m31
public float m32
public float m33
public static final Matrix4f ZERO
public static final Matrix4f IDENTITY
public Matrix4f()
Matrix
that is set to the
identity matrix.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)
public Matrix4f(float[] array)
array
- An array of 16 floats in column-major format (translation in
elements 12, 13 and 14).public Matrix4f(Matrix4f mat)
Matrix
that is set to the
provided matrix. This constructor copies a given Matrix. If the provided
matrix is null, the constructor sets the matrix to the identity.mat
- the matrix to copy.public void copy(Matrix4f matrix)
copy
transfers the contents of a given matrix to this
matrix. If a null matrix is supplied, this matrix is set to the identity
matrix.matrix
- the matrix to copy.public void get(float[] matrix)
get
retrieves the values of this object into a float array
in row-major order.matrix
- the matrix to set the values into.public void get(float[] matrix, boolean rowMajor)
set
retrieves the values of this object into a float array.matrix
- the matrix to set the values into.rowMajor
- whether the outgoing data is in row or column major order.public float get(int i, int j)
get
retrieves a value from the matrix at the given position.
If the position is invalid a JmeException
is thrown.i
- the row index.j
- the colum index.public float[] getColumn(int i)
getColumn
returns one of three columns specified by the
parameter. This column is returned as a float array of length 4.i
- the column to retrieve. Must be between 0 and 3.public float[] getColumn(int i, float[] store)
getColumn
returns one of three columns specified by the
parameter. This column is returned as a float[4].i
- the column to retrieve. Must be between 0 and 3.store
- the float array to store the result in. if null, a new one is
created.public void setColumn(int i, float[] column)
setColumn
sets a particular column of this matrix to that
represented by the provided vector.i
- the column to set.column
- the data to set.public void set(int i, int j, float value)
set
places a given value into the matrix at the given
position. If the position is invalid a JmeException
is
thrown.i
- the row index.j
- the colum index.value
- the value for (i, j).public void set(float[][] matrix)
set
sets the values of this matrix from an array of values.matrix
- the matrix to set the value to.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)
public Matrix4f set(Matrix4f matrix)
set
sets the values of this matrix from another matrix.matrix
- the matrix to read the value from.public void set(float[] matrix)
set
sets the values of this matrix from an array of values
assuming that the data is rowMajor order;matrix
- the matrix to set the value to.public void set(float[] matrix, boolean rowMajor)
set
sets the values of this matrix from an array of values;matrix
- the matrix to set the value to.rowMajor
- whether the incoming data is in row or column major order.public Matrix4f transpose()
public Matrix4f transposeLocal()
transpose
locally transposes this Matrix.public FloatBuffer toFloatBuffer()
toFloatBuffer
returns a FloatBuffer object that contains the
matrix data.public FloatBuffer toFloatBuffer(boolean columnMajor)
toFloatBuffer
returns a FloatBuffer object that contains the
matrix data.columnMajor
- if true, this buffer should be filled with column major data,
otherwise it will be filled row major.public FloatBuffer fillFloatBuffer(FloatBuffer fb)
fillFloatBuffer
fills a FloatBuffer object with the matrix
data.fb
- the buffer to fill, must be correct sizepublic FloatBuffer fillFloatBuffer(FloatBuffer fb, boolean columnMajor)
fillFloatBuffer
fills a FloatBuffer object with the matrix
data.fb
- the buffer to fill, starting at current position. Must have
room for 16 more floats.columnMajor
- if true, this buffer should be filled with column major data,
otherwise it will be filled row major.public void fillFloatArray(float[] f, boolean columnMajor)
public Matrix4f readFloatBuffer(FloatBuffer fb)
readFloatBuffer
reads value for this matrix from a
FloatBuffer.fb
- the buffer to read from, must be correct sizepublic Matrix4f readFloatBuffer(FloatBuffer fb, boolean columnMajor)
readFloatBuffer
reads value for this matrix from a
FloatBuffer.fb
- the buffer to read from, must be correct sizecolumnMajor
- if true, this buffer should be filled with column major data,
otherwise it will be filled row major.public void loadIdentity()
loadIdentity
sets this matrix to the identity matrix, namely
all zeros with ones along the diagonal.public void fromFrustum(float near, float far, float left, float right, float top, float bottom, boolean parallel)
public void fromAngleAxis(float angle, Vector3f axis)
fromAngleAxis
sets this matrix4f to the values specified by
an angle and an axis of rotation. This method creates an object, so use
fromAngleNormalAxis if your axis is already normalized.angle
- the angle to rotate (in radians).axis
- the axis of rotation.public void fromAngleAxis(float angle, float axis_x, float axis_y, float axis_z)
public void fromAngleNormalAxis(float angle, Vector3f axis)
fromAngleNormalAxis
sets this matrix4f to the values
specified by an angle and a normalized axis of rotation.angle
- the angle to rotate (in radians).axis
- the axis of rotation (already normalized).public void fromAngleNormalAxis(float angle, float axis_x, float axis_y, float axis_z)
fromAngleNormalAxis
sets this matrix4f to the values
specified by an angle and a normalized axis of rotation.angle
- the angle to rotate (in radians).public void multLocal(float scalar)
mult
multiplies this matrix by a scalar.scalar
- the scalar to multiply this matrix by.public Matrix4f mult(float scalar)
public Matrix4f mult(Matrix4f in2)
mult
multiplies this matrix with another matrix. The result
matrix will then be returned. This matrix will be on the left hand side,
while the parameter matrix will be on the right.in2
- the matrix to multiply this matrix by.public Matrix4f mult(Matrix4f in2, Matrix4f store)
mult
multiplies this matrix with another matrix. The result
matrix will then be returned. This matrix will be on the left hand side,
while the parameter matrix will be on the right.in2
- the matrix to multiply this matrix by.store
- where to store the result. It is safe for in2 and store to be
the same object.public Matrix4f multLocal(Matrix4f in2)
mult
multiplies this matrix with another matrix. The results
are stored internally and a handle to this matrix will then be returned.
This matrix will be on the left hand side, while the parameter matrix
will be on the right.in2
- the matrix to multiply this matrix by.public Vector3f mult(Vector3f vec)
mult
multiplies a vector about a rotation matrix. The
resulting vector is returned as a new Vector3f.vec
- vec to multiply against.public Vector3f mult(Vector3f vec, Vector3f store)
mult
multiplies a vector about a rotation matrix and adds
translation. The resulting vector is returned.vec
- vec to multiply against.store
- a vector to store the result in. Created if null is passed.public Vector4f mult(Vector4f vec)
mult
multiplies a Vector4f
about a rotation
matrix. The resulting vector is returned as a new Vector4f
.vec
- vec to multiply against.public Vector4f mult(Vector4f vec, Vector4f store)
mult
multiplies a Vector4f
about a rotation
matrix. The resulting vector is returned.vec
- vec to multiply against.store
- a vector to store the result in. Created if null is passed.public Vector4f multAcross(Vector4f vec)
mult
multiplies a vector about a rotation matrix. The
resulting vector is returned.vec
- vec to multiply against.public Vector4f multAcross(Vector4f vec, Vector4f store)
mult
multiplies a vector about a rotation matrix. The
resulting vector is returned.vec
- vec to multiply against.store
- a vector to store the result in. created if null is passed.public Vector3f multNormal(Vector3f vec, Vector3f store)
multNormal
multiplies a vector about a rotation matrix, but
does not add translation. The resulting vector is returned.vec
- vec to multiply against.store
- a vector to store the result in. Created if null is passed.public Vector3f multNormalAcross(Vector3f vec, Vector3f store)
multNormal
multiplies a vector about a rotation matrix, but
does not add translation. The resulting vector is returned.vec
- vec to multiply against.store
- a vector to store the result in. Created if null is passed.public float multProj(Vector3f vec, Vector3f store)
mult
multiplies a vector about a rotation matrix and adds
translation. The w value is returned as a result of multiplying the last
column of the matrix by 1.0vec
- vec to multiply against.store
- a vector to store the result in.public Vector3f multAcross(Vector3f vec, Vector3f store)
mult
multiplies a vector about a rotation matrix. The
resulting vector is returned.vec
- vec to multiply against.store
- a vector to store the result in. created if null is passed.public Quaternion mult(Quaternion vec, Quaternion store)
mult
multiplies a quaternion about a matrix. The resulting
vector is returned.vec
- vec to multiply against.store
- a quaternion to store the result in. created if null is
passed.public float[] mult(float[] vec4f)
mult
multiplies an array of 4 floats against this rotation
matrix. The results are stored directly in the array. (vec4f x mat4f)vec4f
- float array (size 4) to multiply against the matrix.public float[] multAcross(float[] vec4f)
mult
multiplies an array of 4 floats against this rotation
matrix. The results are stored directly in the array. (vec4f x mat4f)vec4f
- float array (size 4) to multiply against the matrix.public Matrix4f invert()
public Matrix4f invert(Matrix4f store)
public Matrix4f invertLocal()
public Matrix4f adjoint()
public Matrix4f adjoint(Matrix4f store)
store
- The matrix to store the result in. If null, a new matrix is
created.public float determinant()
determinant
generates the determinate of this matrix.public Matrix4f zero()
public void addLocal(Matrix4f mat)
add
adds the values of a parameter matrix to this matrix.mat
- the matrix to add to this.public Vector3f toTranslationVector()
public void toTranslationVector(Vector3f vector)
public Quaternion toRotationQuat()
public void toRotationQuat(Quaternion q)
public Matrix3f toRotationMatrix()
public void toRotationMatrix(Matrix3f mat)
public Vector3f toScaleVector()
public void toScaleVector(Vector3f vector)
public void setScale(float x, float y, float z)
public void setScale(Vector3f scale)
public void setTranslation(float[] translation)
setTranslation
will set the matrix's translation values.translation
- the new values for the translation.public void setTranslation(float x, float y, float z)
setTranslation
will set the matrix's translation values.x
- value of the translation on the x axisy
- value of the translation on the y axisz
- value of the translation on the z axispublic void setTranslation(Vector3f translation)
setTranslation
will set the matrix's translation values.translation
- the new values for the translation.public void setInverseTranslation(float[] translation)
setInverseTranslation
will set the matrix's inverse
translation values.translation
- the new values for the inverse translation.public void angleRotation(Vector3f angles)
angleRotation
sets this matrix to that of a rotation about
three axes (x, y, z). Where each axis has a specified rotation in
degrees. These rotations are expressed in a single Vector3f
object.angles
- the angles to rotate.public void setRotationQuaternion(Quaternion quat)
setRotationQuaternion
builds a rotation from a
Quaternion
.quat
- the quaternion to build the rotation from.NullPointerException
- if quat is null.public void setInverseRotationRadians(float[] angles)
setInverseRotationRadians
builds an inverted rotation from
Euler angles that are in radians.angles
- the Euler angles in radians.public void setInverseRotationDegrees(float[] angles)
setInverseRotationDegrees
builds an inverted rotation from
Euler angles that are in degrees.angles
- the Euler angles in degrees.public void inverseTranslateVect(float[] vec)
inverseTranslateVect
translates a given Vector3f by the
translation part of this matrix.vec
- the Vector3f data to be translated.public void inverseTranslateVect(Vector3f data)
inverseTranslateVect
translates a given Vector3f by the
translation part of this matrix.data
- the Vector3f to be translated.public void translateVect(Vector3f data)
inverseTranslateVect
translates a given Vector3f by the
translation part of this matrix.data
- the Vector3f to be translated.public void inverseRotateVect(Vector3f vec)
inverseRotateVect
rotates a given Vector3f by the rotation
part of this matrix.vec
- the Vector3f to be rotated.public void rotateVect(Vector3f vec)
public String toString()
toString
returns the string representation of this object.
It is in a format of a 4x4 matrix. For example, an identity matrix would
be represented by the following string. com.jme.math.Matrix3f public int hashCode()
hashCode
returns the hash code value as an integer and is
supported for the benefit of hashing based collection classes such as
Hashtable, HashMap, HashSet etc.hashCode
in class Object
Object.hashCode()
public boolean equals(Object o)
public boolean isIdentity()
public void multLocal(Quaternion rotation)
public void fromTwoVectors(Vector3f a, Vector3f b)
public void fromTwoVectors(float a_x, float a_y, float a_z, float b_x, float b_y, float b_z)
public void perspective(float fovy, float aspect, float zNear, float zFar)
public void yawPitchRoll(float yaw, float pitch, float roll)
public void orthonormalize()
public Vector3f getEulerAngles()
public void getEulerAngles(Vector3f result)
public Matrix4f translate(float x, float y, float z)
Matrix4f trans = new Matrix4f();
trans.setTranslation(x, y, z);
this.set(trans.mult(this));
return this;
this = T * this
T
is translation matrix).x
- translation in X directiony
- translation in Y directionz
- translation in Z directionthis
reference.public Matrix4f translate(Vector3f trans)
translate(float, float, float)
but the arguments are wrapped in a vector.public Matrix4f rotate(float pitch, float yaw, float roll)
Matrix4f rot = new Matrix4f();
rot.yawPitchRoll(yaw, pitch, roll);
this.set(rot.mult(this));
return this;
this = R * this
R
is rotation matrix).pitch
- Euler's angle (in radians): pitchyaw
- Euler's angle (in radians): yawroll
- Euler's angle (in radians): rollthis
reference.public Matrix4f rotate(Vector3f pitchYawRoll)
rotate(float, float, float)
but the arguments are wrapped in a vector.public Matrix4f rotateDeg(float pitch, float yaw, float roll)
rotate(float, float, float)
but using degrees instead of radians.pitch
- Euler's angle (in degrees): pitchyaw
- Euler's angle (in degrees): yawroll
- Euler's angle (in degrees): rollrotate(float, float, float)
public Matrix4f rotateDeg(Vector3f pitchYawRoll)
rotateDeg(float, float, float)
but the arguments are wrapped in a vector.public Matrix4f rotateAxis(float angle, float axis_x, float axis_y, float axis_z)
Matrix4f rot = new Matrix4f();
rot.fromAngleAxis(angle, axis_x, axis_y, axis_z);
this.set(rot.mult(this));
return this;
this = R * this
R
is rotation matrix). angle
- rotation angle (in radians)axis_x
- X component of the rotation axisaxis_y
- Y component of the rotation axisaxis_z
- Z component of the rotation axisthis
reference.public Matrix4f rotateAxis(float angle, Vector3f axis)
rotateAxis(float, float, float, float)
but axis' components are wrapped in a vector.public Matrix4f rotateAxisDeg(float angle, float axis_x, float axis_y, float axis_z)
rotateAxis(float, float, float, float)
but using degrees instead of radians.angle
- rotation angle (in degrees)axis_x
- X component of the rotation axisaxis_y
- Y component of the rotation axisaxis_z
- Z component of the rotation axisrotateAxis(float, float, float, float)
public Matrix4f rotateAxisDeg(float angle, Vector3f axis)
rotateAxisDeg(float, float, float, float)
but axis' components are wrapped in a vector.public Matrix4f scale(float s)
Matrix4f scale = new Matrix4f();
scale.setScale(s, s, s);
this.set(scale.mult(this));
return this;
this = S * this
S
is scale matrix).s
- scale factorthis
reference.public Matrix4f scale(float x, float y, float z)
Matrix4f scale = new Matrix4f();
scale.setScale(x, y, z);
this.set(scale.mult(this));
return this;
this = S * this
S
is scale matrix).x
- scale factor in X directiony
- scale factor in Y directionz
- scale factor in Z directionthis
reference.public Matrix4f scale(Vector3f scaleVec)
scale(float, float, float)
but arguments are wrapped in a vector.public Matrix4f identity()
this
reference.