Class Matrix4
The memory layout (order of components) is the same as GLSL's column-major and HLSL's row-major, this is just a difference in naming and writing. A matrix looks like this:
[m11 m12 m13 m14]
[m21 m22 m23 m24]
[m31 m32 m33 m34]
[m41 m42 m43 m44]
Where [m41 m42 m43] represents the translation, and they are the last four elements in memory.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add each element of the given matrix to the corresponding element of this matrix.clone()
static Matrix4
Create a copy ofmat
if not null, otherwise a new identity matrix.float
Return the determinant of this matrix.boolean
Returns whether this matrix is exactly equal to another matrix.int
hashCode()
boolean
boolean
static Matrix4c
identity()
Returns a read-only identity matrix.boolean
invert()
Compute the inverse of this matrix.boolean
Compute the inverse of this matrix.boolean
isAffine()
Returns whether this matrix is seen as an affine transformation.boolean
Returns whether this matrix is approximately equal to given matrix.boolean
Returns whether this matrix transforms rect to another rect.boolean
Returns whether this matrix is approximately equivalent to an identity matrix.boolean
Returns whether this matrix at most scales and translates.float
localAARadius
(float left, float top, float right, float bottom) Return the minimum distance needed to move in local (pre-transform) space to ensure that the transformed coordinates are at least 1px away from the original mapped point.float
localAARadius
(Rect2fc bounds) Return the minimum distance needed to move in local (pre-transform) space to ensure that the transformed coordinates are at least 1px away from the original mapped point.float
m11()
float
m12()
float
m13()
float
m14()
float
m21()
float
m22()
float
m23()
float
m24()
float
m31()
float
m32()
float
m33()
float
m34()
float
m41()
float
m42()
float
m43()
float
m44()
static Matrix4
makeOrthographic
(float width, float height, float near, float far, boolean flipY) Create an orthographic projection matrix.static Matrix4
makeOrthographic
(float left, float right, float bottom, float top, float near, float far) Create an orthographic projection matrix.static Matrix4
makePerspective
(float fov, float aspect, float near, float far) Create a perspective projection matrix.static Matrix4
makePerspective
(float left, float right, float bottom, float top, float near, float far) Create a perspective projection matrix.static Matrix4
makeScale
(float x, float y, float z) Create a new scaling transformation matrix.static Matrix4
makeTranslate
(float x, float y, float z) Create a new translation transformation matrix.void
mapPoint
(float[] p) Map a point in the X-Y plane.float
mapPointX
(float x, float y) float
mapPointY
(float x, float y) void
Map the four corners of 'r' and return the bounding box of those points.void
Map the four corners of 'r' and return the bounding box of those points.void
Map the four corners of 'r' and return the bounding box of those points.void
Map the four corners of 'r' and return the bounding box of those points.void
Map the four corners of 'r' and return the bounding box of those points.void
Map the four corners of 'r' and return the bounding box of those points.void
void
Map the four corners of 'r' and return the bounding box of those points.void
mapRectOut
(float left, float top, float right, float bottom, Rect2i dest) Map the four corners of 'r' and return the bounding box of those points.void
mapRectOut
(Rect2fc r, Rect2i dest) Map the four corners of 'r' and return the bounding box of those points.void
mapRectOut
(Rect2ic r, Rect2i dest) Map the four corners of 'r' and return the bounding box of those points.void
mapVec3
(float[] vec) void
If the last column of the matrix is [0, 0, 0, not_one]^T, we will treat the matrix as if it is in perspective, even though it stills behaves like its affine.void
postConcat
(float r11, float r12, float r13, float r14, float r21, float r22, float r23, float r24, float r31, float r32, float r33, float r34, float r41, float r42, float r43, float r44) Post-multiply this matrix by the givenrhs
matrix.void
postConcat
(Matrix3 rhs) Post-multiply this matrix by the givenrhs
matrix.void
postConcat
(Matrix4c rhs) Post-multiply this matrix by the givenrhs
matrix.void
postConcat2D
(Matrixc rhs) Post-multiply this matrix by the givenrhs
matrix.void
postRotate
(double angleX, double angleY, double angleZ) Post-rotates this matrix from the given Euler rotation angles in radians.void
postRotate
(double x, double y, double z, double angle) Post-rotates this matrix about an arbitrary axis with the given angle in radians.void
postRotateX
(double angle) Post-rotates this matrix about the X-axis with the given angle in radians.void
postRotateY
(double angle) Post-rotates this matrix about the Y-axis with the given angle in radians.void
postRotateZ
(double angle) Post-rotates this matrix about the Z-axis with the given angle in radians.void
postScale
(float sx, float sy) Post-multiply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.void
postScale
(float sx, float sy, float sz) Post-multiply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.void
Post-scales this matrix by given vector.void
postScaleX
(float s) Post-scales this matrix by given vector.void
postScaleY
(float s) Post-scales this matrix by given vector.void
postScaleZ
(float s) Post-scales this matrix by given vector.void
postShear
(float sxy, float sxz, float syx, float syz, float szx, float szy) Post-multiply shearing tothis
matrix by the given shearing coefficients.void
postShear2D
(float sx, float sy) Post-multiply 2D shearing tothis
matrix by the given shearing coefficients.void
postTransform
(Vector3 vec) Transform a three-dimensional column vector by post-multiplication (this * vec3, w-component is considered as 1).void
postTransform
(Vector4 vec) Transform a four-dimensional column vector by post-multiplication (matrix * vector).void
postTranslate
(float dx, float dy) Post-multiply a translation to this matrix by translating by the given number of units in x, y and z.void
postTranslate
(float dx, float dy, float dz) Post-multiply a translation to this matrix by translating by the given number of units in x, y and z.void
Post-translates this matrix by given changes.void
postTranslateX
(float dx) Post-translates this matrix by given vector.void
postTranslateY
(float dy) Post-translates this matrix by given vector.void
postTranslateZ
(float dz) Post-translates this matrix by given vector.void
preConcat
(float l11, float l12, float l13, float l14, float l21, float l22, float l23, float l24, float l31, float l32, float l33, float l34, float l41, float l42, float l43, float l44) Pre-multiply this matrix by the givenlhs
matrix.void
Pre-multiply this matrix by the givenlhs
matrix.void
Pre-multiply this matrix by the givenlhs
matrix.void
preConcat2D
(Matrixc lhs) Pre-multiply this matrix by the givenlhs
matrix.void
preRotate
(double angleX, double angleY, double angleZ) Rotates this matrix from the given Euler rotation angles in radians.void
preRotate
(double x, double y, double z, double angle) Rotates this matrix about an arbitrary axis with the given angle in radians.void
Rotate this matrix by the given quaternion's rotation matrix.void
Rotates this matrix about an arbitrary axis.void
preRotateX
(double angle) Rotates this matrix about the X-axis with the given angle in radians.void
preRotateY
(double angle) Rotates this matrix about the Y-axis with the given angle in radians.void
preRotateZ
(double angle) Rotates this matrix about the Z-axis with the given angle in radians.void
preScale
(float sx, float sy) Apply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.void
preScale
(float sx, float sy, float sz) Apply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.void
Scales this matrix by given vector.void
preScaleX
(float s) Scales this matrix by given vector.void
preScaleY
(float s) Scales this matrix by given vector.void
preScaleZ
(float s) Scales this matrix by given vector.void
preShear
(float sxy, float sxz, float syx, float syz, float szx, float szy) Pre-multiply shearing tothis
matrix by the given shearing coefficients.void
preShear2D
(float sx, float sy) Pre-multiply 2D shearing tothis
matrix by the given shearing coefficients.void
preTransform
(Vector3 vec) Transform a three-dimensional row vector by pre-multiplication (vec3 * this, w-component is considered as 1).void
preTransform
(Vector4 vec) Transform a four-dimensional row vector by pre-multiplication (vector * matrix).void
preTranslate
(float dx, float dy) Apply a translation to this matrix by translating by the given number of units in x, y and z.void
preTranslate
(float dx, float dy, float dz) Apply a translation to this matrix by translating by the given number of units in x, y and z.void
Translates this matrix by given changes.void
preTranslateX
(float dx) Translates this matrix by given vector.void
preTranslateY
(float dy) Translates this matrix by given vector.void
preTranslateZ
(float dz) Translates this matrix by given vector.void
set
(float[] a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.void
set
(float[] a, int offset) Set the values in the matrix using a float array that contains the matrix elements in row-major order.void
set
(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) Set the values within this matrix to the given float values.void
set
(long p) Set the values in the matrix using an address that contains the matrix elements in row-major order (UNSAFE).void
Store the values of the given matrix into this matrix.void
set
(ByteBuffer a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.void
set
(FloatBuffer a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.void
Reset this matrix to the identity.setOrthographic
(float width, float height, float near, float far, boolean flipY) Set this matrix to an orthographic projection matrix.setOrthographic
(float left, float right, float bottom, float top, float near, float far) Set this matrix to an orthographic projection matrix.void
setOrthographic
(float left, float right, float bottom, float top, float near, float far, boolean negativeOneToOne) Set this matrix to be an orthographic projection transformation for a right-handed coordinate system using the given NDC z range.void
setOrthographicLH
(float left, float right, float bottom, float top, float near, float far, boolean negativeOneToOne) Set this matrix to be an orthographic projection transformation for a left-handed coordinate system using the given NDC z range.void
setPerspective
(double fov, double aspect, float near, float far, boolean negativeOneToOne) Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.setPerspective
(float fov, float aspect, float near, float far) Set this matrix to a perspective projection matrix.setPerspective
(float left, float right, float bottom, float top, float near, float far) Set this matrix to a perspective projection matrix.void
setPerspectiveLH
(double fov, double aspect, float near, float far, boolean negativeOneToOne) Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range.void
Set this matrix to a rotation matrix by the quaternion's rotation.void
setScale
(float x, float y, float z) Set this matrix to be a simple scale matrix.void
Sets this matrix to a scaling matrix by given components.void
setShear
(float sxy, float sxz, float syx, float syz, float szx, float szy) Resets this matrix to a shearing matrix.void
setTranslate
(float x, float y, float z) Set this matrix to be a simple translation matrix.void
Sets this matrix to a translation matrix by given components.void
setZero()
Set all elements of this matrix to0
.void
store
(float[] a) Store this matrix into the give float array in row-major order.void
store
(float[] a, int offset) Store this matrix into the give float array in row-major order.void
store
(long p) Store this matrix into the given address in GLSL column-major or HLSL row-major order.void
Store this matrix elements to the given matrix.void
store
(ByteBuffer a) Store this matrix into the give float array in row-major order.void
store
(FloatBuffer a) Store this matrix into the give float array in row-major order.void
storeAs2D
(long p) Store this matrix as 2D matrix into the given address in GLSL column-major or HLSL row-major order, NOT vec4 aligned.void
storeAs2DAligned
(long p) Store this matrix as 2D matrix into the given address in GLSL column-major or HLSL row-major order, NOT vec4 aligned.void
Subtract each element of the given matrix from the corresponding element of this matrix.toMatrix()
Converts this 4x4 matrix to 3x3 matrix, the third row and column are discarded.void
Converts this 4x4 matrix to 3x3 matrix, the third row and column are discarded.Converts this 4x4 matrix to 3x3 matrix, the fourth row and column are discarded.void
Converts this 4x4 matrix to 3x3 matrix, the fourth row and column are discarded.toString()
float
trace()
Compute the trace of this matrix.void
Transpose this matrix.
-
Field Details
-
m11
public float m11 -
m12
public float m12 -
m13
public float m13 -
m14
public float m14 -
m21
public float m21 -
m22
public float m22 -
m23
public float m23 -
m24
public float m24 -
m31
public float m31 -
m32
public float m32 -
m33
public float m33 -
m34
public float m34 -
m41
public float m41 -
m42
public float m42 -
m43
public float m43 -
m44
public float m44
-
-
Constructor Details
-
Matrix4
public Matrix4()Create a new identity matrix. -
Matrix4
Create a matrix copied from an existing matrix.- Parameters:
m
- the matrix to create from
-
Matrix4
public Matrix4(@Nonnull float... a) Create a matrix from an array of elements in row-major.- Parameters:
a
- the array to create from- See Also:
-
-
Method Details
-
copy
Create a copy ofmat
if not null, otherwise a new identity matrix. Note: we assume null is identity.- Parameters:
m
- the matrix to copy from- Returns:
- a copy of the matrix
-
identity
Returns a read-only identity matrix.- Returns:
- an identity matrix
-
makeTranslate
Create a new translation transformation matrix.- Parameters:
x
- the x-component of the translationy
- the y-component of the translationz
- the z-component of the translation- Returns:
- the resulting matrix
-
makeScale
Create a new scaling transformation matrix.- Parameters:
x
- the x-component of the scalingy
- the y-component of the scalingz
- the z-component of the scaling- Returns:
- the resulting matrix
-
makeOrthographic
@Nonnull public static Matrix4 makeOrthographic(float left, float right, float bottom, float top, float near, float far) Create an orthographic projection matrix.- Parameters:
left
- the left frustum planeright
- the right frustum planebottom
- the bottom frustum planetop
- the top frustum planenear
- the near frustum plane, must be positivefar
- the far frustum plane, must be positive- Returns:
- the resulting matrix
-
makeOrthographic
@Nonnull public static Matrix4 makeOrthographic(float width, float height, float near, float far, boolean flipY) Create an orthographic projection matrix. The left plane and top plane are considered to be 0.- Parameters:
width
- the distance from right frustum plane to left frustum planeheight
- the distance from bottom frustum plane to top frustum planenear
- the near frustum plane, must be positivefar
- the far frustum plane, must be positiveflipY
- whether to flip the projection vertically- Returns:
- the resulting matrix
-
makePerspective
@Nonnull public static Matrix4 makePerspective(float left, float right, float bottom, float top, float near, float far) Create a perspective projection matrix.- Parameters:
left
- the left frustum planeright
- the right frustum planebottom
- the bottom frustum planetop
- the top frustum planenear
- the near frustum plane, must be positivefar
- the far frustum plane, must be positive- Returns:
- the resulting matrix
-
makePerspective
Create a perspective projection matrix.- Parameters:
fov
- the angle of field of view in radians (0,PI)aspect
- aspect ratio of the view (width / height)near
- the near frustum plane, must be positivefar
- the far frustum plane, must be positive- Returns:
- the resulting matrix
-
m11
public float m11() -
m12
public float m12() -
m13
public float m13() -
m14
public float m14() -
m21
public float m21() -
m22
public float m22() -
m23
public float m23() -
m24
public float m24() -
m31
public float m31() -
m32
public float m32() -
m33
public float m33() -
m34
public float m34() -
m41
public float m41() -
m42
public float m42() -
m43
public float m43() -
m44
public float m44() -
add
Add each element of the given matrix to the corresponding element of this matrix.- Parameters:
m
- the addend
-
subtract
Subtract each element of the given matrix from the corresponding element of this matrix.- Parameters:
m
- the subtrahend
-
preConcat
Pre-multiply this matrix by the givenlhs
matrix.If
M
isthis
matrix andL
thelhs
matrix, then the new matrix will beL * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * L * M
, the transformation of the left-hand side matrix will be applied first.- Parameters:
lhs
- the left-hand side matrix to multiply
-
preConcat
public void preConcat(float l11, float l12, float l13, float l14, float l21, float l22, float l23, float l24, float l31, float l32, float l33, float l34, float l41, float l42, float l43, float l44) Pre-multiply this matrix by the givenlhs
matrix.If
M
isthis
matrix andL
thelhs
matrix, then the new matrix will beL * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * L * M
, the transformation of the left-hand side matrix will be applied first.- Parameters:
l11
- the m11 element of the left-hand side matrixl12
- the m12 element of the left-hand side matrixl13
- the m13 element of the left-hand side matrixl14
- the m14 element of the left-hand side matrixl21
- the m21 element of the left-hand side matrixl22
- the m22 element of the left-hand side matrixl23
- the m23 element of the left-hand side matrixl24
- the m24 element of the left-hand side matrixl31
- the m31 element of the left-hand side matrixl32
- the m32 element of the left-hand side matrixl33
- the m33 element of the left-hand side matrixl34
- the m34 element of the left-hand side matrixl41
- the m41 element of the left-hand side matrixl42
- the m42 element of the left-hand side matrixl43
- the m43 element of the left-hand side matrixl44
- the m44 element of the left-hand side matrix
-
postConcat
Post-multiply this matrix by the givenrhs
matrix.If
M
isthis
matrix andR
therhs
matrix, then the new matrix will beM * R
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * R
, the transformation ofthis
matrix will be applied first.- Parameters:
rhs
- the right-hand side matrix to multiply
-
postConcat
public void postConcat(float r11, float r12, float r13, float r14, float r21, float r22, float r23, float r24, float r31, float r32, float r33, float r34, float r41, float r42, float r43, float r44) Post-multiply this matrix by the givenrhs
matrix.If
M
isthis
matrix andR
therhs
matrix, then the new matrix will beM * R
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * R
, the transformation ofthis
matrix will be applied first.- Parameters:
r11
- the m11 element of the right-hand side matrixr12
- the m12 element of the right-hand side matrixr13
- the m13 element of the right-hand side matrixr14
- the m14 element of the right-hand side matrixr21
- the m21 element of the right-hand side matrixr22
- the m22 element of the right-hand side matrixr23
- the m23 element of the right-hand side matrixr24
- the m24 element of the right-hand side matrixr31
- the m31 element of the right-hand side matrixr32
- the m32 element of the right-hand side matrixr33
- the m33 element of the right-hand side matrixr34
- the m34 element of the right-hand side matrixr41
- the m41 element of the right-hand side matrixr42
- the m42 element of the right-hand side matrixr43
- the m43 element of the right-hand side matrixr44
- the m44 element of the right-hand side matrix
-
preConcat2D
Pre-multiply this matrix by the givenlhs
matrix. The matrix will be expanded to a 4x4 matrix.
If[ a b c ] [ a b 0 c ] [ d e f ] -> [ d e 0 f ] [ g h i ] [ 0 0 1 0 ] [ g h 0 i ]
M
isthis
matrix andL
thelhs
matrix, then the new matrix will beL * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * L * M
, the transformation of the left-hand side matrix will be applied first.- Parameters:
lhs
- the left-hand side matrix to multiply
-
postConcat2D
Post-multiply this matrix by the givenrhs
matrix. The matrix will be expanded to a 4x4 matrix.
If[ a b c ] [ a b 0 c ] [ d e f ] -> [ d e 0 f ] [ g h i ] [ 0 0 1 0 ] [ g h 0 i ]
M
isthis
matrix andR
therhs
matrix, then the new matrix will beM * R
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * R
, the transformation ofthis
matrix will be applied first.- Parameters:
rhs
- the right-hand side matrix to multiply
-
preConcat
Pre-multiply this matrix by the givenlhs
matrix. The matrix will be expanded to a 4x4 matrix.
If[ a b c ] [ a b c 0 ] [ d e f ] -> [ d e f 0 ] [ g h i ] [ g h i 0 ] [ 0 0 0 1 ]
M
isthis
matrix andL
thelhs
matrix, then the new matrix will beL * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * L * M
, the transformation of the left-hand side matrix will be applied first.- Parameters:
lhs
- the left-hand side matrix to multiply
-
postConcat
Post-multiply this matrix by the givenrhs
matrix. The matrix will be expanded to a 4x4 matrix.
If[ a b c ] [ a b c 0 ] [ d e f ] -> [ d e f 0 ] [ g h i ] [ g h i 0 ] [ 0 0 0 1 ]
M
isthis
matrix andR
therhs
matrix, then the new matrix will beM * R
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * R
, the transformation ofthis
matrix will be applied first.- Parameters:
rhs
- the right-hand side matrix to multiply
-
setZero
public void setZero()Set all elements of this matrix to0
. -
setIdentity
public void setIdentity()Reset this matrix to the identity. -
set
Store the values of the given matrix into this matrix.- Parameters:
m
- the matrix to copy from
-
set
public void set(float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44) Set the values within this matrix to the given float values.- Parameters:
m11
- the new value of m11m12
- the new value of m12m13
- the new value of m13m14
- the new value of m14m21
- the new value of m21m22
- the new value of m22m23
- the new value of m23m24
- the new value of m24m31
- the new value of m31m32
- the new value of m32m33
- the new value of m33m34
- the new value of m34m41
- the new value of m41m42
- the new value of m42m43
- the new value of m43m44
- the new value of m44
-
set
public void set(@Nonnull float[] a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.- Parameters:
a
- the array to copy from
-
set
public void set(@Nonnull float[] a, int offset) Set the values in the matrix using a float array that contains the matrix elements in row-major order.- Parameters:
a
- the array to copy fromoffset
- the element offset
-
set
Set the values in the matrix using a float array that contains the matrix elements in row-major order.- Parameters:
a
- the array to copy from
-
set
Set the values in the matrix using a float array that contains the matrix elements in row-major order.- Parameters:
a
- the array to copy from
-
set
public void set(long p) Set the values in the matrix using an address that contains the matrix elements in row-major order (UNSAFE).- Parameters:
p
- the pointer of the array to copy from
-
store
Store this matrix elements to the given matrix. -
store
public void store(@Nonnull float[] a) Store this matrix into the give float array in row-major order. -
store
public void store(@Nonnull float[] a, int offset) Store this matrix into the give float array in row-major order. -
store
Store this matrix into the give float array in row-major order. -
store
Store this matrix into the give float array in row-major order. -
store
public void store(long p) Store this matrix into the given address in GLSL column-major or HLSL row-major order. -
storeAs2D
public void storeAs2D(long p) Store this matrix as 2D matrix into the given address in GLSL column-major or HLSL row-major order, NOT vec4 aligned.Equivalent to call
toMatrix()
andMatrix.store(long)
. -
storeAs2DAligned
public void storeAs2DAligned(long p) Store this matrix as 2D matrix into the given address in GLSL column-major or HLSL row-major order, NOT vec4 aligned.Equivalent to call
toMatrix()
andMatrix.storeAligned(long)
.- Specified by:
storeAs2DAligned
in interfaceMatrix4c
- Parameters:
p
- the pointer of the array to store
-
determinant
public float determinant()Return the determinant of this matrix.- Specified by:
determinant
in interfaceMatrix4c
- Returns:
- the determinant
-
trace
public float trace()Compute the trace of this matrix.- Returns:
- the trace of this matrix
-
transpose
public void transpose()Transpose this matrix. -
invert
@CheckReturnValue public boolean invert()Compute the inverse of this matrix. This matrix will be inverted if it is invertible, otherwise it keeps the same as before.- Returns:
true
if this matrix is invertible.
-
invert
Compute the inverse of this matrix. The matrix will be inverted if this matrix is invertible, otherwise it keeps the same as before. -
setOrthographic
@Nonnull public Matrix4 setOrthographic(float left, float right, float bottom, float top, float near, float far) Set this matrix to an orthographic projection matrix.- Parameters:
left
- the left frustum planeright
- the right frustum planebottom
- the bottom frustum planetop
- the top frustum planenear
- the near frustum plane, must be positivefar
- the far frustum plane, must be positive- Returns:
- this
-
setOrthographic
@Nonnull public Matrix4 setOrthographic(float width, float height, float near, float far, boolean flipY) Set this matrix to an orthographic projection matrix.- Parameters:
width
- the distance from right frustum plane to left frustum planeheight
- the distance from bottom frustum plane to top frustum planenear
- the near frustum plane, must be positivefar
- the far frustum plane, must be positiveflipY
- whether to flip the projection vertically- Returns:
- this
-
setOrthographic
public void setOrthographic(float left, float right, float bottom, float top, float near, float far, boolean negativeOneToOne) Set this matrix to be an orthographic projection transformation for a right-handed coordinate system using the given NDC z range.- Parameters:
left
- the distance from the center to the left frustum edgeright
- the distance from the center to the right frustum edgebottom
- the distance from the center to the bottom frustum edgetop
- the distance from the center to the top frustum edgenear
- near clipping plane distancefar
- far clipping plane distancenegativeOneToOne
- whether to use Vulkan's and Direct3D's NDC z range of[0..+1]
whenfalse
or whether to use OpenGL's NDC z range of[-1..+1]
whentrue
-
setOrthographicLH
public void setOrthographicLH(float left, float right, float bottom, float top, float near, float far, boolean negativeOneToOne) Set this matrix to be an orthographic projection transformation for a left-handed coordinate system using the given NDC z range.- Parameters:
left
- the distance from the center to the left frustum edgeright
- the distance from the center to the right frustum edgebottom
- the distance from the center to the bottom frustum edgetop
- the distance from the center to the top frustum edgenear
- near clipping plane distancefar
- far clipping plane distancenegativeOneToOne
- whether to use Vulkan's and Direct3D's NDC z range of[0..+1]
whenfalse
or whether to use OpenGL's NDC z range of[-1..+1]
whentrue
-
setPerspective
@Nonnull public Matrix4 setPerspective(float left, float right, float bottom, float top, float near, float far) Set this matrix to a perspective projection matrix.- Parameters:
left
- the left frustum planeright
- the right frustum planebottom
- the bottom frustum planetop
- the top frustum planenear
- the near frustum plane, must be positivefar
- the far frustum plane, must be positive- Returns:
- this
-
setPerspective
Set this matrix to a perspective projection matrix.- Parameters:
fov
- the angle of field of view in radians (0,PI)aspect
- aspect ratio of the view (width / height)near
- the near frustum plane, must be positivefar
- the far frustum plane, must be positive- Returns:
- this
-
setPerspective
public void setPerspective(double fov, double aspect, float near, float far, boolean negativeOneToOne) Set this matrix to be a symmetric perspective projection frustum transformation for a right-handed coordinate system using the given NDC z range.- Parameters:
fov
- the field of view in radians (must be greater than zero and less than PI)aspect
- the aspect ratio of the view (i.e. width / height)near
- the near clipping plane, must be positivefar
- the far clipping plane, must be positivenegativeOneToOne
- whether to use Vulkan's and Direct3D's NDC z range of[0..+1]
whenfalse
or whether to use OpenGL's NDC z range of[-1..+1]
whentrue
-
setPerspectiveLH
public void setPerspectiveLH(double fov, double aspect, float near, float far, boolean negativeOneToOne) Set this matrix to be a symmetric perspective projection frustum transformation for a left-handed coordinate system using the given NDC z range.- Parameters:
fov
- the field of view in radians (must be greater than zero and less than PI)aspect
- the aspect ratio of the view (i.e. width / height)near
- the near clipping plane, must be positivefar
- the far clipping plane, must be positivenegativeOneToOne
- whether to use Vulkan's and Direct3D's NDC z range of[0..+1]
whenfalse
or whether to use OpenGL's NDC z range of[-1..+1]
whentrue
-
preTranslateX
public void preTranslateX(float dx) Translates this matrix by given vector. This is equivalent to pre-multiplying by a translation matrix.- Parameters:
dx
- the x-component of the translation
-
postTranslateX
public void postTranslateX(float dx) Post-translates this matrix by given vector. This is equivalent to post-multiplying by a translation matrix.- Parameters:
dx
- the x-component of the translation
-
preTranslateY
public void preTranslateY(float dy) Translates this matrix by given vector. This is equivalent to pre-multiplying by a translation matrix.- Parameters:
dy
- the y-component of the translation
-
postTranslateY
public void postTranslateY(float dy) Post-translates this matrix by given vector. This is equivalent to post-multiplying by a translation matrix.- Parameters:
dy
- the y-component of the translation
-
preTranslateZ
public void preTranslateZ(float dz) Translates this matrix by given vector. This is equivalent to pre-multiplying by a translation matrix.- Parameters:
dz
- the z-component of the translation
-
postTranslateZ
public void postTranslateZ(float dz) Post-translates this matrix by given vector. This is equivalent to post-multiplying by a translation matrix.- Parameters:
dz
- the z-component of the translation
-
preTranslate
Translates this matrix by given changes. This is equivalent to pre-multiplying by a translation matrix. (translation * this)- Parameters:
t
- the translation vector
-
preTranslate
public void preTranslate(float dx, float dy, float dz) Apply a translation to this matrix by translating by the given number of units in x, y and z.If
M
isthis
matrix andT
the translation matrix, then the new matrix will beT * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * T * M
, the translation will be applied first.- Parameters:
dx
- the x-component of the translationdy
- the y-component of the translationdz
- the z-component of the translation
-
preTranslate
public void preTranslate(float dx, float dy) Apply a translation to this matrix by translating by the given number of units in x, y and z.If
M
isthis
matrix andT
the translation matrix, then the new matrix will beT * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * T * M
, the translation will be applied first.- Parameters:
dx
- the x-component of the translationdy
- the y-component of the translation
-
postTranslate
Post-translates this matrix by given changes. This is equivalent to post-multiplying by a translation matrix. (this * translation)- Parameters:
t
- the translation vector
-
postTranslate
public void postTranslate(float dx, float dy, float dz) Post-multiply a translation to this matrix by translating by the given number of units in x, y and z.If
M
isthis
matrix andT
the translation matrix, then the new matrix will beM * T
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * T
, the translation will be applied last.- Parameters:
dx
- the x-component of the translationdy
- the y-component of the translationdz
- the z-component of the translation
-
postTranslate
public void postTranslate(float dx, float dy) Post-multiply a translation to this matrix by translating by the given number of units in x, y and z.If
M
isthis
matrix andT
the translation matrix, then the new matrix will beM * T
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * T
, the translation will be applied last.- Parameters:
dx
- the x-component of the translationdy
- the y-component of the translation
-
setTranslate
Sets this matrix to a translation matrix by given components.- Parameters:
t
- the translation vector
-
setTranslate
public void setTranslate(float x, float y, float z) Set this matrix to be a simple translation matrix.- Parameters:
x
- the x-component of the translationy
- the y-component of the translationz
- the z-component of the translation
-
preScaleX
public void preScaleX(float s) Scales this matrix by given vector. This is equivalent to pre-multiplying by a scale matrix.- Parameters:
s
- the x-component of the scale
-
postScaleX
public void postScaleX(float s) Post-scales this matrix by given vector. This is equivalent to post-multiplying by a scale matrix.- Parameters:
s
- the x-component of the scale
-
preScaleY
public void preScaleY(float s) Scales this matrix by given vector. This is equivalent to pre-multiplying by a scale matrix.- Parameters:
s
- the y-component of the scale
-
postScaleY
public void postScaleY(float s) Post-scales this matrix by given vector. This is equivalent to post-multiplying by a scale matrix.- Parameters:
s
- the y-component of the scale
-
preScaleZ
public void preScaleZ(float s) Scales this matrix by given vector. This is equivalent to pre-multiplying by a scale matrix.- Parameters:
s
- the x-component of the scale
-
postScaleZ
public void postScaleZ(float s) Post-scales this matrix by given vector. This is equivalent to post-multiplying by a scale matrix.- Parameters:
s
- the x-component of the scale
-
preScale
Scales this matrix by given vector. This is equivalent to pre-multiplying by a scale matrix.- Parameters:
s
- the scale vector
-
preScale
public void preScale(float sx, float sy, float sz) Apply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.If
M
isthis
matrix andS
the scaling matrix, then the new matrix will beS * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * S * M
, the scaling will be applied first.- Parameters:
sx
- the x-component of the scalesy
- the y-component of the scalesz
- the z-component of the scale
-
preScale
public void preScale(float sx, float sy) Apply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.If
M
isthis
matrix andS
the scaling matrix, then the new matrix will beS * M
(row-major). So when transforming a vectorv
with the new matrix by usingv * S * M
, the scaling will be applied first.- Parameters:
sx
- the x-component of the scalesy
- the y-component of the scale
-
postScale
Post-scales this matrix by given vector. This is equivalent to post-multiplying by a scale matrix.- Parameters:
s
- the scale vector
-
postScale
public void postScale(float sx, float sy, float sz) Post-multiply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.If
M
isthis
matrix andS
the scaling matrix, then the new matrix will beM * S
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * S
, the scaling will be applied last.- Parameters:
sx
- the x-component of the scalesy
- the y-component of the scalesz
- the z-component of the scale
-
postScale
public void postScale(float sx, float sy) Post-multiply scaling tothis
matrix by scaling the base axes by the given x, y and z factors and store the result indest
.If
M
isthis
matrix andS
the scaling matrix, then the new matrix will beM * S
(row-major). So when transforming a vectorv
with the new matrix by usingv * M * S
, the scaling will be applied last.- Parameters:
sx
- the x-component of the scalesy
- the y-component of the scale
-
setScale
Sets this matrix to a scaling matrix by given components.- Parameters:
s
- the scale vector
-
setScale
public void setScale(float x, float y, float z) Set this matrix to be a simple scale matrix.- Parameters:
x
- the x-component of the scaley
- the y-component of the scalez
- the z-component of the scale
-
preShear
public void preShear(float sxy, float sxz, float syx, float syz, float szx, float szy) Pre-multiply shearing tothis
matrix by the given shearing coefficients.This is equivalent to pre-multiplying by a shearing matrix.
1 sxy sxz syx 1 syz szx szy 1 - Parameters:
sxy
- the y-component of the shearing in x direction, x is unchangedsxz
- the z-component of the shearing in x direction, x is unchangedsyx
- the x-component of the shearing in y direction, y is unchangedsyz
- the z-component of the shearing in y direction, y is unchangedszx
- the x-component of the shearing in z direction, z is unchangedszy
- the y-component of the shearing in z direction, z is unchanged
-
postShear
public void postShear(float sxy, float sxz, float syx, float syz, float szx, float szy) Post-multiply shearing tothis
matrix by the given shearing coefficients.This is equivalent to post-multiplying by a shearing matrix.
1 sxy sxz syx 1 syz szx szy 1 - Parameters:
sxy
- the y-component of the shearing in x direction, x is unchangedsxz
- the z-component of the shearing in x direction, x is unchangedsyx
- the x-component of the shearing in y direction, y is unchangedsyz
- the z-component of the shearing in y direction, y is unchangedszx
- the x-component of the shearing in z direction, z is unchangedszy
- the y-component of the shearing in z direction, z is unchanged
-
preShear2D
public void preShear2D(float sx, float sy) Pre-multiply 2D shearing tothis
matrix by the given shearing coefficients.- Parameters:
sx
- the x-component of the shearing in y direction, y is unchanged (horizontal shearing)sy
- the y-component of the shearing in x direction, x is unchanged (vertical shearing)
-
postShear2D
public void postShear2D(float sx, float sy) Post-multiply 2D shearing tothis
matrix by the given shearing coefficients.- Parameters:
sx
- the x-component of the shearing in y direction, y is unchanged (horizontal shearing)sy
- the y-component of the shearing in x direction, x is unchanged (vertical shearing)
-
setShear
public void setShear(float sxy, float sxz, float syx, float syz, float szx, float szy) Resets this matrix to a shearing matrix. -
preRotateX
public void preRotateX(double angle) Rotates this matrix about the X-axis with the given angle in radians.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to pre-multiplying by a rotation matrix.
1 0 0 0 cosθ sinθ 0 -sinθ cosθ - Parameters:
angle
- the rotation angle in radians.
-
postRotateX
public void postRotateX(double angle) Post-rotates this matrix about the X-axis with the given angle in radians.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to post-multiplying by a rotation matrix.
1 0 0 0 cosθ sinθ 0 -sinθ cosθ - Parameters:
angle
- the rotation angle in radians.
-
preRotateY
public void preRotateY(double angle) Rotates this matrix about the Y-axis with the given angle in radians.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to pre-multiplying by a rotation matrix.
cosθ 0 -sinθ 0 1 0 sinθ 0 cosθ - Parameters:
angle
- the rotation angle in radians.
-
postRotateY
public void postRotateY(double angle) Post-rotates this matrix about the Y-axis with the given angle in radians.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to post-multiplying by a rotation matrix.
cosθ 0 -sinθ 0 1 0 sinθ 0 cosθ - Parameters:
angle
- the rotation angle in radians.
-
preRotateZ
public void preRotateZ(double angle) Rotates this matrix about the Z-axis with the given angle in radians.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to pre-multiplying by a rotation matrix.
cosθ sinθ 0 -sinθ cosθ 0 0 0 1 - Parameters:
angle
- the rotation angle in radians.
-
postRotateZ
public void postRotateZ(double angle) Post-rotates this matrix about the Z-axis with the given angle in radians.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to post-multiplying by a rotation matrix.
cosθ sinθ 0 -sinθ cosθ 0 0 0 1 - Parameters:
angle
- the rotation angle in radians.
-
preRotate
public void preRotate(double angleX, double angleY, double angleZ) Rotates this matrix from the given Euler rotation angles in radians.The rotations are applied in the given order and using chained rotation per axis:
- x - pitch -
preRotateX(double)
- y - yaw -
preRotateY(double)
- z - roll -
preRotateZ(double)
This is equivalent to pre-multiplying by three rotation matrices.
- Parameters:
angleX
- the Euler pitch angle in radians. (rotation about the X axis)angleY
- the Euler yaw angle in radians. (rotation about the Y axis)angleZ
- the Euler roll angle in radians. (rotation about the Z axis)- See Also:
- x - pitch -
-
postRotate
public void postRotate(double angleX, double angleY, double angleZ) Post-rotates this matrix from the given Euler rotation angles in radians.The rotations are applied in the given order and using chained rotation per axis:
- x - pitch -
postRotateX(double)
- y - yaw -
postRotateY(double)
- z - roll -
postRotateZ(double)
This is equivalent to post-multiplying by three rotation matrices.
- Parameters:
angleX
- the Euler pitch angle in radians. (rotation about the X axis)angleY
- the Euler yaw angle in radians. (rotation about the Y axis)angleZ
- the Euler roll angle in radians. (rotation about the Z axis)- See Also:
- x - pitch -
-
preRotate
Rotates this matrix about an arbitrary axis. The axis must be a normalized (unit) vector. If the axis is X, Y or Z, use axis-specified methods to rotate this matrix which are faster.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
- Parameters:
axis
- the rotation axisangle
- rotation angle in radians- See Also:
-
preRotate
public void preRotate(double x, double y, double z, double angle) Rotates this matrix about an arbitrary axis with the given angle in radians. The axis described by the three components must be normalized. If it is known that the rotation axis is X, Y or Z, use axis-specified methods instead.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to pre-multiplying by a quaternion.
- Parameters:
x
- x-coordinate of rotation axisy
- y-coordinate of rotation axisz
- z-coordinate of rotation axisangle
- rotation angle in radians- See Also:
-
preRotate
Rotate this matrix by the given quaternion's rotation matrix. (quat * this)- Parameters:
q
- the quaternion to rotate by.
-
postRotate
public void postRotate(double x, double y, double z, double angle) Post-rotates this matrix about an arbitrary axis with the given angle in radians. The axis described by the three components must be normalized. If it is known that the rotation axis is X, Y or Z, use axis-specified methods instead.When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise.
This is equivalent to post-multiplying by a quaternion.
- Parameters:
x
- x-coordinate of rotation axisy
- y-coordinate of rotation axisz
- z-coordinate of rotation axisangle
- rotation angle in radians- See Also:
-
setRotation
Set this matrix to a rotation matrix by the quaternion's rotation.- Parameters:
q
- the quaternion to set by.
-
preTransform
Transform a four-dimensional row vector by pre-multiplication (vector * matrix). This is equivalent to (matrix * vector) in GLSL.- Parameters:
vec
- the vector to transform
-
postTransform
Transform a four-dimensional column vector by post-multiplication (matrix * vector). This is equivalent to (vector * matrix) in GLSL.- Parameters:
vec
- the vector to transform
-
preTransform
Transform a three-dimensional row vector by pre-multiplication (vec3 * this, w-component is considered as 1). This should be used with position vectors.- Parameters:
vec
- the vector to transform
-
postTransform
Transform a three-dimensional column vector by post-multiplication (this * vec3, w-component is considered as 1). This should be used with normal vectors.- Parameters:
vec
- the vector to transform
-
mapRect
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRect
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRect
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRect
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRect
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRect
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRectOut
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0.- Specified by:
mapRectOut
in interfaceMatrix4c
-
mapRectOut
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0.- Specified by:
mapRectOut
in interfaceMatrix4c
-
mapRectOut
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRectIn
Description copied from interface:Matrix4c
Map the four corners of 'r' and return the bounding box of those points. The four corners of 'r' are assumed to have z = 0 and w = 1. If the matrix has perspective, the returned rectangle will be the bounding box of the projected points after being clipped to w > 0. -
mapRectIn
-
mapPoint
public void mapPoint(@Nonnull float[] p) Map a point in the X-Y plane.- Parameters:
p
- the point to transform
-
mapPointX
public float mapPointX(float x, float y) -
mapPointY
public float mapPointY(float x, float y) -
mapVec3
public void mapVec3(float[] vec) -
isAffine
public boolean isAffine()Returns whether this matrix is seen as an affine transformation. Otherwise, there's a perspective projection.- Returns:
true
if this matrix is affine.
-
isScaleTranslate
public boolean isScaleTranslate()Returns whether this matrix at most scales and translates.- Specified by:
isScaleTranslate
in interfaceMatrix4c
- Returns:
true
if this matrix is scale, translate, or both.
-
isAxisAligned
public boolean isAxisAligned()Returns whether this matrix transforms rect to another rect. If true, this matrix is identity, or/and scales, or/and rotates round Z axis a multiple of 90 degrees, or mirrors on axes. In all cases, this matrix is affine and may also have translation.For example:
Matrix4 matrix = Matrix4.identity(); matrix.translate(3, 5, 7); matrix.scale(2, 3, 4); matrix.rotateX(MathUtil.PI_DIV_4); matrix.rotateZ(MathUtil.PI_DIV_2);
- Specified by:
isAxisAligned
in interfaceMatrix4c
- Returns:
- true if this matrix transform one rect into another
-
normalizePerspective
public void normalizePerspective()If the last column of the matrix is [0, 0, 0, not_one]^T, we will treat the matrix as if it is in perspective, even though it stills behaves like its affine. If we divide everything by the not_one value, then it will behave the same, but will be treated as affine, and therefore faster (e.g. clients can forward-difference calculations). -
hasPerspective
public boolean hasPerspective()- Specified by:
hasPerspective
in interfaceMatrix4c
-
hasTranslation
public boolean hasTranslation() -
isIdentity
public boolean isIdentity()Returns whether this matrix is approximately equivalent to an identity matrix.- Returns:
true
if this matrix is identity.
-
localAARadius
Return the minimum distance needed to move in local (pre-transform) space to ensure that the transformed coordinates are at least 1px away from the original mapped point. This minimum distance is specific to the given local 'bounds' since the scale factors change with perspective.If the bounds will be clipped by the w=0 plane or otherwise is ill-conditioned, this will return positive infinity.
- Specified by:
localAARadius
in interfaceMatrix4c
-
localAARadius
public float localAARadius(float left, float top, float right, float bottom) Return the minimum distance needed to move in local (pre-transform) space to ensure that the transformed coordinates are at least 1px away from the original mapped point. This minimum distance is specific to the given local 'bounds' since the scale factors change with perspective.If the bounds will be clipped by the w=0 plane or otherwise is ill-conditioned, this will return positive infinity.
- Specified by:
localAARadius
in interfaceMatrix4c
-
toMatrix
Converts this 4x4 matrix to 3x3 matrix, the third row and column are discarded.[ a b x c ] [ a b c ] [ d e x f ] -> [ d e f ] [ x x x x ] [ g h i ] [ g h x i ]
-
toMatrix
Converts this 4x4 matrix to 3x3 matrix, the third row and column are discarded.[ a b x c ] [ a b c ] [ d e x f ] -> [ d e f ] [ x x x x ] [ g h i ] [ g h x i ]
-
toMatrix3
Converts this 4x4 matrix to 3x3 matrix, the fourth row and column are discarded.[ a b c x ] [ a b c ] [ d e f x ] -> [ d e f ] [ g h i x ] [ g h i ] [ x x x x ]
-
toMatrix3
Converts this 4x4 matrix to 3x3 matrix, the fourth row and column are discarded.[ a b c x ] [ a b c ] [ d e f x ] -> [ d e f ] [ g h i x ] [ g h i ] [ x x x x ]
-
isApproxEqual
Returns whether this matrix is approximately equal to given matrix.- Specified by:
isApproxEqual
in interfaceMatrix4c
- Parameters:
m
- the matrix to compare.- Returns:
true
if this matrix is equivalent to other matrix.
-
hashCode
public int hashCode() -
equals
Returns whether this matrix is exactly equal to another matrix. -
toString
-
clone
-