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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd each element of the given matrix to the corresponding element of this matrix.@NonNull Matrix4clone()static @NonNull Matrix4Create a copy ofmatif not null, otherwise a new identity matrix.floatReturn the determinant of this matrix.booleanReturns whether this matrix is exactly equal to another matrix.inthashCode()booleanbooleanstatic @NonNull Matrix4cidentity()Returns a read-only identity matrix.booleaninvert()Compute the inverse of this matrix.booleanCompute the inverse of this matrix.booleanisAffine()Returns whether this matrix is seen as an affine transformation.booleanisApproxEqual(@NonNull Matrix4 m) Returns whether this matrix is approximately equal to given matrix.booleanReturns whether this matrix transforms rect to another rect.booleanReturns whether this matrix is approximately equivalent to an identity matrix.booleanReturns whether this matrix at most scales and translates.floatlocalAARadius(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.floatlocalAARadius(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.floatm11()floatm12()floatm13()floatm14()floatm21()floatm22()floatm23()floatm24()floatm31()floatm32()floatm33()floatm34()floatm41()floatm42()floatm43()floatm44()static @NonNull Matrix4makeOrthographic(float width, float height, float near, float far, boolean flipY) Create an orthographic projection matrix.static @NonNull Matrix4makeOrthographic(float left, float right, float bottom, float top, float near, float far) Create an orthographic projection matrix.static @NonNull Matrix4makePerspective(float fov, float aspect, float near, float far) Create a perspective projection matrix.static @NonNull Matrix4makePerspective(float left, float right, float bottom, float top, float near, float far) Create a perspective projection matrix.static @NonNull Matrix4makeScale(float x, float y, float z) Create a new scaling transformation matrix.static @NonNull Matrix4makeTranslate(float x, float y, float z) Create a new translation transformation matrix.voidmapPoint(float @NonNull [] p) Map a point in the X-Y plane.floatmapPointX(float x, float y) floatmapPointY(float x, float y) voidMap the four corners of 'r' and return the bounding box of those points.voidMap the four corners of 'r' and return the bounding box of those points.voidMap the four corners of 'r' and return the bounding box of those points.voidMap the four corners of 'r' and return the bounding box of those points.voidMap the four corners of 'r' and return the bounding box of those points.voidMap the four corners of 'r' and return the bounding box of those points.voidvoidMap the four corners of 'r' and return the bounding box of those points.voidmapRectOut(float left, float top, float right, float bottom, @NonNull Rect2i dest) Map the four corners of 'r' and return the bounding box of those points.voidmapRectOut(@NonNull Rect2fc r, @NonNull Rect2i dest) Map the four corners of 'r' and return the bounding box of those points.voidmapRectOut(@NonNull Rect2ic r, @NonNull Rect2i dest) Map the four corners of 'r' and return the bounding box of those points.voidmapVec3(float[] vec) voidIf 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.voidpostConcat(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 givenrhsmatrix.voidpostConcat(@NonNull Matrix3 rhs) Post-multiply this matrix by the givenrhsmatrix.voidpostConcat(@NonNull Matrix4c rhs) Post-multiply this matrix by the givenrhsmatrix.voidpostConcat2D(float r11, float r12, float r14, float r21, float r22, float r24, float r41, float r42, float r44) Post-multiply this matrix by the givenrhsmatrix.voidpostRotate(double angleX, double angleY, double angleZ) Post-rotates this matrix from the given Euler rotation angles in radians.voidpostRotate(double x, double y, double z, double angle) Post-rotates this matrix about an arbitrary axis with the given angle in radians.voidpostRotateX(double angle) Post-rotates this matrix about the X-axis with the given angle in radians.voidpostRotateY(double angle) Post-rotates this matrix about the Y-axis with the given angle in radians.voidpostRotateZ(double angle) Post-rotates this matrix about the Z-axis with the given angle in radians.voidpostScale(float sx, float sy) Post-multiply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.voidpostScale(float sx, float sy, float sz) Post-multiply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.voidPost-scales this matrix by given vector.voidpostScaleX(float s) Post-scales this matrix by given vector.voidpostScaleY(float s) Post-scales this matrix by given vector.voidpostScaleZ(float s) Post-scales this matrix by given vector.voidpostShear(float sxy, float sxz, float syx, float syz, float szx, float szy) Post-multiply shearing tothismatrix by the given shearing coefficients.voidpostShear2D(float sx, float sy) Post-multiply 2D shearing tothismatrix by the given shearing coefficients.voidpostTransform(@NonNull Vector3 vec) Transform a three-dimensional column vector by post-multiplication (this * vec3, w-component is considered as 1).voidpostTransform(@NonNull Vector4 vec) Transform a four-dimensional column vector by post-multiplication (matrix * vector).voidpostTranslate(float dx, float dy) Post-multiply a translation to this matrix by translating by the given number of units in x, y and z.voidpostTranslate(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.voidpostTranslate(@NonNull Vector3 t) Post-translates this matrix by given changes.voidpostTranslateX(float dx) Post-translates this matrix by given vector.voidpostTranslateY(float dy) Post-translates this matrix by given vector.voidpostTranslateZ(float dz) Post-translates this matrix by given vector.voidpreConcat(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 givenlhsmatrix.voidPre-multiply this matrix by the givenlhsmatrix.voidPre-multiply this matrix by the givenlhsmatrix.voidpreConcat2D(float l11, float l12, float l14, float l21, float l22, float l24, float l41, float l42, float l44) Pre-multiply this matrix by the givenlhsmatrix.voidpreRotate(double angleX, double angleY, double angleZ) Rotates this matrix from the given Euler rotation angles in radians.voidpreRotate(double x, double y, double z, double angle) Rotates this matrix about an arbitrary axis with the given angle in radians.voidpreRotate(@NonNull Quaternion q) Rotate this matrix by the given quaternion's rotation matrix.voidRotates this matrix about an arbitrary axis.voidpreRotateX(double angle) Rotates this matrix about the X-axis with the given angle in radians.voidpreRotateY(double angle) Rotates this matrix about the Y-axis with the given angle in radians.voidpreRotateZ(double angle) Rotates this matrix about the Z-axis with the given angle in radians.voidpreScale(float sx, float sy) Apply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.voidpreScale(float sx, float sy, float sz) Apply scaling tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.voidScales this matrix by given vector.voidpreScaleX(float s) Scales this matrix by given vector.voidpreScaleY(float s) Scales this matrix by given vector.voidpreScaleZ(float s) Scales this matrix by given vector.voidpreShear(float sxy, float sxz, float syx, float syz, float szx, float szy) Pre-multiply shearing tothismatrix by the given shearing coefficients.voidpreShear2D(float sx, float sy) Pre-multiply 2D shearing tothismatrix by the given shearing coefficients.voidpreTransform(@NonNull Vector3 vec) Transform a three-dimensional row vector by pre-multiplication (vec3 * this, w-component is considered as 1).voidpreTransform(@NonNull Vector4 vec) Transform a four-dimensional row vector by pre-multiplication (vector * matrix).voidpreTranslate(float dx, float dy) Apply a translation to this matrix by translating by the given number of units in x, y and z.voidpreTranslate(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.voidpreTranslate(@NonNull Vector3 t) Translates this matrix by given changes.voidpreTranslateX(float dx) Translates this matrix by given vector.voidpreTranslateY(float dy) Translates this matrix by given vector.voidpreTranslateZ(float dz) Translates this matrix by given vector.voidset(float @NonNull [] a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.voidset(float @NonNull [] a, int offset) Set the values in the matrix using a float array that contains the matrix elements in row-major order.voidset(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.voidset(long p) Set the values in the matrix using an address that contains the matrix elements in row-major order (UNSAFE).voidStore the values of the given matrix into this matrix.voidset(@NonNull ByteBuffer a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.voidset(@NonNull FloatBuffer a) Set the values in the matrix using a float array that contains the matrix elements in row-major order.voidReset this matrix to the identity.@NonNull Matrix4setOrthographic(float width, float height, float near, float far, boolean flipY) Set this matrix to an orthographic projection matrix.@NonNull Matrix4setOrthographic(float left, float right, float bottom, float top, float near, float far) Set this matrix to an orthographic projection matrix.voidsetOrthographic(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.voidsetOrthographicLH(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.voidsetPerspective(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.@NonNull Matrix4setPerspective(float fov, float aspect, float near, float far) Set this matrix to a perspective projection matrix.@NonNull Matrix4setPerspective(float left, float right, float bottom, float top, float near, float far) Set this matrix to a perspective projection matrix.voidsetPerspectiveLH(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.voidsetRotation(@NonNull Quaternion q) Set this matrix to a rotation matrix by the quaternion's rotation.voidsetScale(float x, float y, float z) Set this matrix to be a simple scale matrix.voidSets this matrix to a scaling matrix by given components.voidsetShear(float sxy, float sxz, float syx, float syz, float szx, float szy) Resets this matrix to a shearing matrix.voidsetTranslate(float x, float y, float z) Set this matrix to be a simple translation matrix.voidsetTranslate(@NonNull Vector3 t) Sets this matrix to a translation matrix by given components.voidsetZero()Set all elements of this matrix to0.voidstore(float @NonNull [] a) Store this matrix into the give float array in row-major order.voidstore(float @NonNull [] a, int offset) Store this matrix into the give float array in row-major order.voidstore(long p) Store this matrix into the given address in GLSL column-major or HLSL row-major order.voidStore this matrix elements to the given matrix.voidstore(@NonNull ByteBuffer a) Store this matrix into the give float array in row-major order.voidstore(@NonNull FloatBuffer a) Store this matrix into the give float array in row-major order.voidstoreAs2D(long p) Store this matrix as 2D matrix into the given address in GLSL column-major or HLSL row-major order, NOT vec4 aligned.voidstoreAs2DAligned(long p) Store this matrix as 2D matrix into the given address in GLSL column-major or HLSL row-major order, NOT vec4 aligned.voidSubtract each element of the given matrix from the corresponding element of this matrix.@NonNull Matrix3Converts this 4x4 matrix to 3x3 matrix, the fourth row and column are discarded.voidConverts this 4x4 matrix to 3x3 matrix, the fourth row and column are discarded.toString()floattrace()Compute the trace of this matrix.voidTranspose 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(float @NonNull ... 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 ofmatif 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
public static @NonNull 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
public static @NonNull 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
public static @NonNull 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 givenlhsmatrix.If
Misthismatrix andLthelhsmatrix, then the new matrix will beL * M(row-major). So when transforming a vectorvwith 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 givenlhsmatrix.If
Misthismatrix andLthelhsmatrix, then the new matrix will beL * M(row-major). So when transforming a vectorvwith 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 givenrhsmatrix.If
Misthismatrix andRtherhsmatrix, then the new matrix will beM * R(row-major). So when transforming a vectorvwith the new matrix by usingv * M * R, the transformation ofthismatrix 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 givenrhsmatrix.If
Misthismatrix andRtherhsmatrix, then the new matrix will beM * R(row-major). So when transforming a vectorvwith the new matrix by usingv * M * R, the transformation ofthismatrix 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
public void preConcat2D(float l11, float l12, float l14, float l21, float l22, float l24, float l41, float l42, float l44) Pre-multiply this matrix by the givenlhsmatrix. 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 ]Misthismatrix andLthelhsmatrix, then the new matrix will beL * M(row-major). So when transforming a vectorvwith the new matrix by usingv * L * M, the transformation of the left-hand side matrix will be applied first. -
postConcat2D
public void postConcat2D(float r11, float r12, float r14, float r21, float r22, float r24, float r41, float r42, float r44) Post-multiply this matrix by the givenrhsmatrix. 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 ]Misthismatrix andRtherhsmatrix, then the new matrix will beM * R(row-major). So when transforming a vectorvwith the new matrix by usingv * M * R, the transformation ofthismatrix will be applied first. -
preConcat
Pre-multiply this matrix by the givenlhsmatrix. 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 ]Misthismatrix andLthelhsmatrix, then the new matrix will beL * M(row-major). So when transforming a vectorvwith 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 givenrhsmatrix. 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 ]Misthismatrix andRtherhsmatrix, then the new matrix will beM * R(row-major). So when transforming a vectorvwith the new matrix by usingv * M * R, the transformation ofthismatrix 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(float @NonNull [] 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(float @NonNull [] 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(float @NonNull [] a) Store this matrix into the give float array in row-major order. -
store
public void store(float @NonNull [] 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.- Parameters:
p- the pointer of the array to store
-
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.- Parameters:
p- the pointer of the array to store
-
determinant
public float determinant()Return the determinant of this matrix.- Specified by:
determinantin 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:
trueif 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
public @NonNull 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
public @NonNull 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]whenfalseor 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]whenfalseor whether to use OpenGL's NDC z range of[-1..+1]whentrue
-
setPerspective
public @NonNull 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]whenfalseor 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]whenfalseor 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
Misthismatrix andTthe translation matrix, then the new matrix will beT * M(row-major). So when transforming a vectorvwith 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
Misthismatrix andTthe translation matrix, then the new matrix will beT * M(row-major). So when transforming a vectorvwith 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
Misthismatrix andTthe translation matrix, then the new matrix will beM * T(row-major). So when transforming a vectorvwith 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
Misthismatrix andTthe translation matrix, then the new matrix will beM * T(row-major). So when transforming a vectorvwith 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 tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M(row-major). So when transforming a vectorvwith 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 tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M(row-major). So when transforming a vectorvwith 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 tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S(row-major). So when transforming a vectorvwith 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 tothismatrix by scaling the base axes by the given x, y and z factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S(row-major). So when transforming a vectorvwith 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 tothismatrix 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 tothismatrix 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 tothismatrix 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 tothismatrix 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:
mapRectOutin 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:
mapRectOutin 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:Matrix4cMap 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(float @NonNull [] 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:
trueif this matrix is affine.
-
isScaleTranslate
public boolean isScaleTranslate()Returns whether this matrix at most scales and translates.- Specified by:
isScaleTranslatein interfaceMatrix4c- Returns:
trueif 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:
isAxisAlignedin 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:
hasPerspectivein interfaceMatrix4c
-
hasTranslation
public boolean hasTranslation() -
isIdentity
public boolean isIdentity()Returns whether this matrix is approximately equivalent to an identity matrix.- Returns:
trueif 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:
localAARadiusin 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:
localAARadiusin interfaceMatrix4c
-
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:
isApproxEqualin interfaceMatrix4c- Parameters:
m- the matrix to compare.- Returns:
trueif this matrix is equivalent to other matrix.
-
hashCode
public int hashCode() -
equals
Returns whether this matrix is exactly equal to another matrix. -
toString
-
clone
-