public class Matrix4 extends Object implements Serializable
Vector3
class it allows the chaining of methods by returning a reference to itself. For example:
Matrix4 mat = new Matrix4().trn(position).mul(camera.combined);
Modifier and Type | Field and Description |
---|---|
static int |
M00
XX: Typically the unrotated X component for scaling, also the cosine of the angle when rotated on the Y and/or Z axis.
|
static int |
M01
XY: Typically the negative sine of the angle when rotated on the Z axis.
|
static int |
M02
XZ: Typically the sine of the angle when rotated on the Y axis.
|
static int |
M03
XW: Typically the translation of the X component.
|
static int |
M10
YX: Typically the sine of the angle when rotated on the Z axis.
|
static int |
M11
YY: Typically the unrotated Y component for scaling, also the cosine of the angle when rotated on the X and/or Z axis.
|
static int |
M12
YZ: Typically the negative sine of the angle when rotated on the X axis.
|
static int |
M13
YW: Typically the translation of the Y component.
|
static int |
M20
ZX: Typically the negative sine of the angle when rotated on the Y axis.
|
static int |
M21
ZY: Typical the sine of the angle when rotated on the X axis.
|
static int |
M22
ZZ: Typically the unrotated Z component for scaling, also the cosine of the angle when rotated on the X and/or Y axis.
|
static int |
M23
ZW: Typically the translation of the Z component.
|
static int |
M30
WX: Typically the value zero.
|
static int |
M31
WY: Typically the value zero.
|
static int |
M32
WZ: Typically the value zero.
|
static int |
M33
WW: Typically the value one.
|
float[] |
val |
Constructor and Description |
---|
Matrix4()
Constructs an identity matrix
|
Matrix4(float[] values)
Constructs a matrix from the given float array.
|
Matrix4(Matrix4 matrix)
Constructs a matrix from the given matrix.
|
Matrix4(Quaternion quaternion)
Constructs a rotation matrix from the given
Quaternion . |
Matrix4(Vector3 position,
Quaternion rotation,
Vector3 scale)
Construct a matrix from the given translation, rotation and scale.
|
Modifier and Type | Method and Description |
---|---|
Matrix4 |
avg(Matrix4[] t)
Averages the given transforms and stores the result in this matrix.
|
Matrix4 |
avg(Matrix4[] t,
float[] w)
Averages the given transforms with the given weights and stores the result in this matrix.
|
Matrix4 |
avg(Matrix4 other,
float w)
Averages the given transform with this one and stores the result in this matrix.
|
Matrix4 |
cpy() |
float |
det() |
static float |
det(float[] values)
Computes the determinante of the given matrix.
|
float |
det3x3() |
void |
extract4x3Matrix(float[] dst)
Copies the 4x3 upper-left sub-matrix into float array.
|
Quaternion |
getRotation(Quaternion rotation)
Gets the rotation of this matrix.
|
Quaternion |
getRotation(Quaternion rotation,
boolean normalizeAxes)
Gets the rotation of this matrix.
|
Vector3 |
getScale(Vector3 scale) |
float |
getScaleX() |
float |
getScaleXSquared() |
float |
getScaleY() |
float |
getScaleYSquared() |
float |
getScaleZ() |
float |
getScaleZSquared() |
Vector3 |
getTranslation(Vector3 position) |
float[] |
getValues() |
Matrix4 |
idt()
Sets the matrix to an identity matrix.
|
Matrix4 |
inv()
Inverts the matrix.
|
static boolean |
inv(float[] values)
Computes the inverse of the given matrix.
|
Matrix4 |
lerp(Matrix4 matrix,
float alpha)
Linearly interpolates between this matrix and the given matrix mixing by alpha
|
static void |
mul(float[] mata,
float[] matb)
Multiplies the matrix mata with matrix matb, storing the result in mata.
|
Matrix4 |
mul(Matrix4 matrix)
Postmultiplies this matrix with the given matrix, storing the result in this matrix.
|
Matrix4 |
mulLeft(Matrix4 matrix)
Premultiplies this matrix with the given matrix, storing the result in this matrix.
|
static void |
mulVec(float[] mat,
float[] vec)
Multiplies the vector with the given matrix.
|
static void |
mulVec(float[] mat,
float[] vecs,
int offset,
int numVecs,
int stride)
Multiplies the vectors with the given matrix.
|
static void |
prj(float[] mat,
float[] vec)
Multiplies the vector with the given matrix, performing a division by w.
|
static void |
prj(float[] mat,
float[] vecs,
int offset,
int numVecs,
int stride)
Multiplies the vectors with the given matrix, , performing a division by w.
|
static void |
rot(float[] mat,
float[] vec)
Multiplies the vector with the top most 3x3 sub-matrix of the given matrix.
|
static void |
rot(float[] mat,
float[] vecs,
int offset,
int numVecs,
int stride)
Multiplies the vectors with the top most 3x3 sub-matrix of the given matrix.
|
Matrix4 |
rotate(float axisX,
float axisY,
float axisZ,
float degrees)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Matrix4 |
rotate(Quaternion rotation)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Matrix4 |
rotate(Vector3 axis,
float degrees)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Matrix4 |
rotate(Vector3 v1,
Vector3 v2)
Postmultiplies this matrix by the rotation between two vectors.
|
Matrix4 |
rotateRad(float axisX,
float axisY,
float axisZ,
float radians)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Matrix4 |
rotateRad(Vector3 axis,
float radians)
Postmultiplies this matrix with a (counter-clockwise) rotation matrix.
|
Matrix4 |
scale(float scaleX,
float scaleY,
float scaleZ)
Postmultiplies this matrix with a scale matrix.
|
Matrix4 |
scl(float scale) |
Matrix4 |
scl(float x,
float y,
float z) |
Matrix4 |
scl(Vector3 scale) |
Matrix4 |
set(Affine2 affine)
Sets this matrix to the given affine matrix.
|
Matrix4 |
set(float[] values)
Sets the matrix to the given matrix as a float array.
|
Matrix4 |
set(float quaternionX,
float quaternionY,
float quaternionZ,
float quaternionW)
Sets the matrix to a rotation matrix representing the quaternion.
|
Matrix4 |
set(float translationX,
float translationY,
float translationZ,
float quaternionX,
float quaternionY,
float quaternionZ,
float quaternionW)
Sets the matrix to a rotation matrix representing the translation and quaternion.
|
Matrix4 |
set(float translationX,
float translationY,
float translationZ,
float quaternionX,
float quaternionY,
float quaternionZ,
float quaternionW,
float scaleX,
float scaleY,
float scaleZ)
Sets the matrix to a rotation matrix representing the translation and quaternion.
|
Matrix4 |
set(Matrix3 mat)
Sets this matrix to the given 3x3 matrix.
|
Matrix4 |
set(Matrix4 matrix)
Sets the matrix to the given matrix.
|
Matrix4 |
set(Quaternion quaternion)
Sets the matrix to a rotation matrix representing the quaternion.
|
Matrix4 |
set(Vector3 position,
Quaternion orientation)
Set this matrix to the specified translation and rotation.
|
Matrix4 |
set(Vector3 position,
Quaternion orientation,
Vector3 scale)
Set this matrix to the specified translation, rotation and scale.
|
Matrix4 |
set(Vector3 xAxis,
Vector3 yAxis,
Vector3 zAxis,
Vector3 pos)
Sets the four columns of the matrix which correspond to the x-, y- and z-axis of the vector space this matrix creates as
well as the 4th column representing the translation of any point that is multiplied by this matrix.
|
Matrix4 |
setAsAffine(Affine2 affine)
Assumes that this matrix is a 2D affine transformation, copying only the relevant components.
|
Matrix4 |
setAsAffine(Matrix4 mat)
Assumes that both matrices are 2D affine transformations, copying only the relevant components.
|
Matrix4 |
setFromEulerAngles(float yaw,
float pitch,
float roll)
Sets this matrix to a rotation matrix from the given euler angles.
|
Matrix4 |
setToLookAt(Vector3 direction,
Vector3 up)
Sets the matrix to a look at matrix with a direction and an up vector.
|
Matrix4 |
setToLookAt(Vector3 position,
Vector3 target,
Vector3 up)
Sets this matrix to a look at matrix with the given position, target and up vector.
|
Matrix4 |
setToOrtho(float left,
float right,
float bottom,
float top,
float near,
float far)
Sets the matrix to an orthographic projection like glOrtho (http://www.opengl.org/sdk/docs/man/xhtml/glOrtho.xml) following
the OpenGL equivalent
|
Matrix4 |
setToOrtho2D(float x,
float y,
float width,
float height)
Sets this matrix to an orthographic projection matrix with the origin at (x,y) extending by width and height.
|
Matrix4 |
setToOrtho2D(float x,
float y,
float width,
float height,
float near,
float far)
Sets this matrix to an orthographic projection matrix with the origin at (x,y) extending by width and height, having a near
and far plane.
|
Matrix4 |
setToProjection(float near,
float far,
float fovy,
float aspectRatio)
Sets the matrix to a projection matrix with a near- and far plane, a field of view in degrees and an aspect ratio.
|
Matrix4 |
setToProjection(float left,
float right,
float bottom,
float top,
float near,
float far)
Sets the matrix to a projection matrix with a near/far plane, and left, bottom, right and top specifying the points on the
near plane that are mapped to the lower left and upper right corners of the viewport.
|
Matrix4 |
setToRotation(float axisX,
float axisY,
float axisZ,
float degrees)
Sets the matrix to a rotation matrix around the given axis.
|
Matrix4 |
setToRotation(float x1,
float y1,
float z1,
float x2,
float y2,
float z2)
Set the matrix to a rotation matrix between two vectors.
|
Matrix4 |
setToRotation(Vector3 axis,
float degrees)
Sets the matrix to a rotation matrix around the given axis.
|
Matrix4 |
setToRotation(Vector3 v1,
Vector3 v2)
Set the matrix to a rotation matrix between two vectors.
|
Matrix4 |
setToRotationRad(float axisX,
float axisY,
float axisZ,
float radians)
Sets the matrix to a rotation matrix around the given axis.
|
Matrix4 |
setToRotationRad(Vector3 axis,
float radians)
Sets the matrix to a rotation matrix around the given axis.
|
Matrix4 |
setToScaling(float x,
float y,
float z)
Sets this matrix to a scaling matrix
|
Matrix4 |
setToScaling(Vector3 vector)
Sets this matrix to a scaling matrix
|
Matrix4 |
setToTranslation(float x,
float y,
float z)
Sets this matrix to a translation matrix, overwriting it first by an identity matrix and then setting the 4th column to the
translation vector.
|
Matrix4 |
setToTranslation(Vector3 vector)
Sets this matrix to a translation matrix, overwriting it first by an identity matrix and then setting the 4th column to the
translation vector.
|
Matrix4 |
setToTranslationAndScaling(float translationX,
float translationY,
float translationZ,
float scalingX,
float scalingY,
float scalingZ)
Sets this matrix to a translation and scaling matrix by first overwriting it with an identity and then setting the
translation vector in the 4th column and the scaling vector in the diagonal.
|
Matrix4 |
setToTranslationAndScaling(Vector3 translation,
Vector3 scaling)
Sets this matrix to a translation and scaling matrix by first overwriting it with an identity and then setting the
translation vector in the 4th column and the scaling vector in the diagonal.
|
Matrix4 |
setToWorld(Vector3 position,
Vector3 forward,
Vector3 up) |
Matrix4 |
setTranslation(float x,
float y,
float z)
Sets the 4th column to the translation vector.
|
Matrix4 |
setTranslation(Vector3 vector)
Sets the 4th column to the translation vector.
|
Matrix4 |
toNormalMatrix()
removes the translational part and transposes the matrix.
|
String |
toString() |
Matrix4 |
tra()
Transposes the matrix.
|
Matrix4 |
translate(float x,
float y,
float z)
Postmultiplies this matrix by a translation matrix.
|
Matrix4 |
translate(Vector3 translation)
Postmultiplies this matrix by a translation matrix.
|
Matrix4 |
trn(float x,
float y,
float z)
Adds a translational component to the matrix in the 4th column.
|
Matrix4 |
trn(Vector3 vector)
Adds a translational component to the matrix in the 4th column.
|
public static final int M00
public static final int M01
public static final int M02
public static final int M03
public static final int M10
public static final int M11
public static final int M12
public static final int M13
public static final int M20
public static final int M21
public static final int M22
public static final int M23
public static final int M30
public static final int M31
public static final int M32
public static final int M33
public final float[] val
public Matrix4()
public Matrix4(Matrix4 matrix)
matrix
- The matrix to copy. (This matrix is not modified)public Matrix4(float[] values)
values
- The float array to copy. Remember that this matrix is in column major order. (The float array is not modified)public Matrix4(Quaternion quaternion)
Quaternion
.quaternion
- The quaternion to be copied. (The quaternion is not modified)public Matrix4(Vector3 position, Quaternion rotation, Vector3 scale)
position
- The translationrotation
- The rotation, must be normalizedscale
- The scalepublic Matrix4 set(Matrix4 matrix)
matrix
- The matrix that is to be copied. (The given matrix is not modified)public Matrix4 set(float[] values)
values
- The matrix, in float form, that is to be copied. Remember that this matrix is in column major order.public Matrix4 set(Quaternion quaternion)
quaternion
- The quaternion that is to be used to set this matrix.public Matrix4 set(float quaternionX, float quaternionY, float quaternionZ, float quaternionW)
quaternionX
- The X component of the quaternion that is to be used to set this matrix.quaternionY
- The Y component of the quaternion that is to be used to set this matrix.quaternionZ
- The Z component of the quaternion that is to be used to set this matrix.quaternionW
- The W component of the quaternion that is to be used to set this matrix.public Matrix4 set(Vector3 position, Quaternion orientation)
position
- The translationorientation
- The rotation, must be normalizedpublic Matrix4 set(float translationX, float translationY, float translationZ, float quaternionX, float quaternionY, float quaternionZ, float quaternionW)
translationX
- The X component of the translation that is to be used to set this matrix.translationY
- The Y component of the translation that is to be used to set this matrix.translationZ
- The Z component of the translation that is to be used to set this matrix.quaternionX
- The X component of the quaternion that is to be used to set this matrix.quaternionY
- The Y component of the quaternion that is to be used to set this matrix.quaternionZ
- The Z component of the quaternion that is to be used to set this matrix.quaternionW
- The W component of the quaternion that is to be used to set this matrix.public Matrix4 set(Vector3 position, Quaternion orientation, Vector3 scale)
position
- The translationorientation
- The rotation, must be normalizedscale
- The scalepublic Matrix4 set(float translationX, float translationY, float translationZ, float quaternionX, float quaternionY, float quaternionZ, float quaternionW, float scaleX, float scaleY, float scaleZ)
translationX
- The X component of the translation that is to be used to set this matrix.translationY
- The Y component of the translation that is to be used to set this matrix.translationZ
- The Z component of the translation that is to be used to set this matrix.quaternionX
- The X component of the quaternion that is to be used to set this matrix.quaternionY
- The Y component of the quaternion that is to be used to set this matrix.quaternionZ
- The Z component of the quaternion that is to be used to set this matrix.quaternionW
- The W component of the quaternion that is to be used to set this matrix.scaleX
- The X component of the scaling that is to be used to set this matrix.scaleY
- The Y component of the scaling that is to be used to set this matrix.scaleZ
- The Z component of the scaling that is to be used to set this matrix.public Matrix4 set(Vector3 xAxis, Vector3 yAxis, Vector3 zAxis, Vector3 pos)
xAxis
- The x-axis.yAxis
- The y-axis.zAxis
- The z-axis.pos
- The translation vector.public Matrix4 cpy()
public Matrix4 trn(Vector3 vector)
vector
- The translation vector to add to the current matrix. (This vector is not modified)public Matrix4 trn(float x, float y, float z)
x
- The x-component of the translation vector.y
- The y-component of the translation vector.z
- The z-component of the translation vector.public float[] getValues()
public Matrix4 mul(Matrix4 matrix)
A.mul(B) results in A := AB.
matrix
- The other matrix to multiply by.public Matrix4 mulLeft(Matrix4 matrix)
A.mulLeft(B) results in A := BA.
matrix
- The other matrix to multiply by.public Matrix4 tra()
public Matrix4 idt()
public Matrix4 inv()
RuntimeException
- if the matrix is singular (not invertible)public float det()
public float det3x3()
public Matrix4 setToProjection(float near, float far, float fovy, float aspectRatio)
near
- The near planefar
- The far planefovy
- The field of view of the height in degreesaspectRatio
- The "width over height" aspect ratiopublic Matrix4 setToProjection(float left, float right, float bottom, float top, float near, float far)
left
- right
- bottom
- top
- near
- The near planefar
- The far planepublic Matrix4 setToOrtho2D(float x, float y, float width, float height)
x
- The x-coordinate of the originy
- The y-coordinate of the originwidth
- The widthheight
- The heightpublic Matrix4 setToOrtho2D(float x, float y, float width, float height, float near, float far)
x
- The x-coordinate of the originy
- The y-coordinate of the originwidth
- The widthheight
- The heightnear
- The near planefar
- The far planepublic Matrix4 setToOrtho(float left, float right, float bottom, float top, float near, float far)
left
- The left clipping planeright
- The right clipping planebottom
- The bottom clipping planetop
- The top clipping planenear
- The near clipping planefar
- The far clipping planepublic Matrix4 setTranslation(Vector3 vector)
vector
- The translation vectorpublic Matrix4 setTranslation(float x, float y, float z)
x
- The X coordinate of the translation vectory
- The Y coordinate of the translation vectorz
- The Z coordinate of the translation vectorpublic Matrix4 setToTranslation(Vector3 vector)
vector
- The translation vectorpublic Matrix4 setToTranslation(float x, float y, float z)
x
- The x-component of the translation vector.y
- The y-component of the translation vector.z
- The z-component of the translation vector.public Matrix4 setToTranslationAndScaling(Vector3 translation, Vector3 scaling)
translation
- The translation vectorscaling
- The scaling vectorpublic Matrix4 setToTranslationAndScaling(float translationX, float translationY, float translationZ, float scalingX, float scalingY, float scalingZ)
translationX
- The x-component of the translation vectortranslationY
- The y-component of the translation vectortranslationZ
- The z-component of the translation vectorscalingX
- The x-component of the scaling vectorscalingY
- The x-component of the scaling vectorscalingZ
- The x-component of the scaling vectorpublic Matrix4 setToRotation(Vector3 axis, float degrees)
axis
- The axisdegrees
- The angle in degreespublic Matrix4 setToRotationRad(Vector3 axis, float radians)
axis
- The axisradians
- The angle in radianspublic Matrix4 setToRotation(float axisX, float axisY, float axisZ, float degrees)
axisX
- The x-component of the axisaxisY
- The y-component of the axisaxisZ
- The z-component of the axisdegrees
- The angle in degreespublic Matrix4 setToRotationRad(float axisX, float axisY, float axisZ, float radians)
axisX
- The x-component of the axisaxisY
- The y-component of the axisaxisZ
- The z-component of the axisradians
- The angle in radianspublic Matrix4 setToRotation(Vector3 v1, Vector3 v2)
v1
- The base vectorv2
- The target vectorpublic Matrix4 setToRotation(float x1, float y1, float z1, float x2, float y2, float z2)
x1
- The base vectors x valuey1
- The base vectors y valuez1
- The base vectors z valuex2
- The target vector x valuey2
- The target vector y valuez2
- The target vector z valuepublic Matrix4 setFromEulerAngles(float yaw, float pitch, float roll)
yaw
- the yaw in degreespitch
- the pitch in degreesroll
- the roll in degreespublic Matrix4 setToScaling(Vector3 vector)
vector
- The scaling vectorpublic Matrix4 setToScaling(float x, float y, float z)
x
- The x-component of the scaling vectory
- The y-component of the scaling vectorz
- The z-component of the scaling vectorpublic Matrix4 setToLookAt(Vector3 direction, Vector3 up)
direction
- The direction vectorup
- The up vectorpublic Matrix4 setToLookAt(Vector3 position, Vector3 target, Vector3 up)
position
- the positiontarget
- the targetup
- the up vectorpublic Matrix4 lerp(Matrix4 matrix, float alpha)
matrix
- the matrixalpha
- the alpha value in the range [0,1]public Matrix4 avg(Matrix4 other, float w)
other
- The other transformw
- Weight of this transform; weight of the other transform is (1 - w)public Matrix4 avg(Matrix4[] t)
t
- List of transformspublic Matrix4 avg(Matrix4[] t, float[] w)
t
- List of transformsw
- List of weightspublic Matrix4 set(Matrix3 mat)
mat
- the matrixpublic Matrix4 set(Affine2 affine)
[ M00 M01 0 M02 ] [ M10 M11 0 M12 ] [ 0 0 1 0 ] [ 0 0 0 1 ]
affine
- the affine matrixpublic Matrix4 setAsAffine(Affine2 affine)
[ M00 M01 _ M02 ] [ M10 M11 _ M12 ] [ _ _ _ _ ] [ _ _ _ _ ]
affine
- the source matrixpublic Matrix4 setAsAffine(Matrix4 mat)
[ M00 M01 _ M03 ] [ M10 M11 _ M13 ] [ _ _ _ _ ] [ _ _ _ _ ]
mat
- the source matrixpublic Matrix4 scl(float x, float y, float z)
public Matrix4 scl(float scale)
public Quaternion getRotation(Quaternion rotation, boolean normalizeAxes)
rotation
- The Quaternion
to receive the rotationnormalizeAxes
- True to normalize the axes, necessary when the matrix might also include scaling.Quaternion
for chaining.public Quaternion getRotation(Quaternion rotation)
rotation
- The Quaternion
to receive the rotationQuaternion
for chaining.public float getScaleXSquared()
public float getScaleYSquared()
public float getScaleZSquared()
public float getScaleX()
public float getScaleY()
public float getScaleZ()
public Vector3 getScale(Vector3 scale)
scale
- The vector which will receive the (non-negative) scale components on each axis.public Matrix4 toNormalMatrix()
public static void mul(float[] mata, float[] matb)
val
. This is the same as mul(Matrix4)
.mata
- the first matrix.matb
- the second matrix.public static void mulVec(float[] mat, float[] vec)
val
. The vector array is assumed to hold a 3-component vector, with x being the first element, y being
the second and z being the last component. The result is stored in the vector array. This is the same as
Vector3.mul(Matrix4)
.mat
- the matrixvec
- the vector.public static void mulVec(float[] mat, float[] vecs, int offset, int numVecs, int stride)
val
. The vectors array is assumed to hold 3-component vectors. Offset specifies the offset into the
array where the x-component of the first vector is located. The numVecs parameter specifies the number of vectors stored in
the vectors array. The stride parameter specifies the number of floats between subsequent vectors and must be >= 3. This is
the same as Vector3.mul(Matrix4)
applied to multiple vectors.mat
- the matrixvecs
- the vectorsoffset
- the offset into the vectors arraynumVecs
- the number of vectorsstride
- the stride between vectors in floatspublic static void prj(float[] mat, float[] vec)
val
. The vector array is assumed to hold a 3-component vector, with x being
the first element, y being the second and z being the last component. The result is stored in the vector array. This is the
same as Vector3.prj(Matrix4)
.mat
- the matrixvec
- the vector.public static void prj(float[] mat, float[] vecs, int offset, int numVecs, int stride)
val
. The vectors array is assumed to hold 3-component vectors. Offset
specifies the offset into the array where the x-component of the first vector is located. The numVecs parameter specifies
the number of vectors stored in the vectors array. The stride parameter specifies the number of floats between subsequent
vectors and must be >= 3. This is the same as Vector3.prj(Matrix4)
applied to multiple vectors.mat
- the matrixvecs
- the vectorsoffset
- the offset into the vectors arraynumVecs
- the number of vectorsstride
- the stride between vectors in floatspublic static void rot(float[] mat, float[] vec)
val
. The vector array is assumed to hold a 3-component vector, with x being
the first element, y being the second and z being the last component. The result is stored in the vector array. This is the
same as Vector3.rot(Matrix4)
.mat
- the matrixvec
- the vector.public static void rot(float[] mat, float[] vecs, int offset, int numVecs, int stride)
val
. The vectors array is assumed to hold 3-component vectors.
Offset specifies the offset into the array where the x-component of the first vector is located. The numVecs parameter
specifies the number of vectors stored in the vectors array. The stride parameter specifies the number of floats between
subsequent vectors and must be >= 3. This is the same as Vector3.rot(Matrix4)
applied to multiple vectors.mat
- the matrixvecs
- the vectorsoffset
- the offset into the vectors arraynumVecs
- the number of vectorsstride
- the stride between vectors in floatspublic static boolean inv(float[] values)
val
.values
- the matrix values.public static float det(float[] values)
val
.values
- the matrix values.public Matrix4 translate(Vector3 translation)
translation
- public Matrix4 translate(float x, float y, float z)
x
- Translation in the x-axis.y
- Translation in the y-axis.z
- Translation in the z-axis.public Matrix4 rotate(Vector3 axis, float degrees)
axis
- The vector axis to rotate around.degrees
- The angle in degrees.public Matrix4 rotateRad(Vector3 axis, float radians)
axis
- The vector axis to rotate around.radians
- The angle in radians.public Matrix4 rotate(float axisX, float axisY, float axisZ, float degrees)
axisX
- The x-axis component of the vector to rotate around.axisY
- The y-axis component of the vector to rotate around.axisZ
- The z-axis component of the vector to rotate around.degrees
- The angle in degreespublic Matrix4 rotateRad(float axisX, float axisY, float axisZ, float radians)
axisX
- The x-axis component of the vector to rotate around.axisY
- The y-axis component of the vector to rotate around.axisZ
- The z-axis component of the vector to rotate around.radians
- The angle in radianspublic Matrix4 rotate(Quaternion rotation)
rotation
- public Matrix4 rotate(Vector3 v1, Vector3 v2)
v1
- The base vectorv2
- The target vectorpublic Matrix4 scale(float scaleX, float scaleY, float scaleZ)
scaleX
- The scale in the x-axis.scaleY
- The scale in the y-axis.scaleZ
- The scale in the z-axis.public void extract4x3Matrix(float[] dst)
dst
- the destination matrixCopyright © 2015. All rights reserved.