Package icyllis.arc3d.core
Interface Matrix4c
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
Matrix4
Interface to a read-only view of a 4x4 matrix for 3D transformation.
This does not mean that the matrix is immutable, it only implies that
a method should not change the state of the matrix.
Matrix4 const &matrix
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionclone()
float
Return the determinant of this matrix.boolean
boolean
Compute the inverse of this matrix.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 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()
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
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
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.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.
-
Method Details
-
m11
float m11() -
m12
float m12() -
m13
float m13() -
m14
float m14() -
m21
float m21() -
m22
float m22() -
m23
float m23() -
m24
float m24() -
m31
float m31() -
m32
float m32() -
m33
float m33() -
m34
float m34() -
m41
float m41() -
m42
float m42() -
m43
float m43() -
m44
float m44() -
store
Store this matrix elements to the given matrix.- Parameters:
m
- the matrix to store
-
store
void store(@Nonnull float[] a) Store this matrix into the give float array in row-major order.- Parameters:
a
- the array to store into
-
store
void store(@Nonnull float[] a, int offset) Store this matrix into the give float array in row-major order.- Parameters:
a
- the array to store intooffset
- the element offset
-
store
Store this matrix into the give float array in row-major order.- Parameters:
a
- the pointer of the array to store
-
store
Store this matrix into the give float array in row-major order.- Parameters:
a
- the pointer of the array to store
-
store
void store(long p) Store this matrix into the given address in GLSL column-major or HLSL row-major order.- Parameters:
p
- the pointer of the array to store
-
storeAs2D
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)
.- Parameters:
p
- the pointer of the array to store
-
storeAs2DAligned
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)
.- Parameters:
p
- the pointer of the array to store
-
determinant
float determinant()Return the determinant of this matrix.- Returns:
- the determinant
-
invert
Compute the inverse of this matrix. The matrix will be inverted if this matrix is invertible, otherwise it keeps the same as before.- Parameters:
dest
- the destination matrix- Returns:
true
if this matrix is invertible.
-
isAxisAligned
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);
- Returns:
- true if this matrix transform one rect into another
-
isScaleTranslate
boolean isScaleTranslate()Returns whether this matrix at most scales and translates.- Returns:
true
if this matrix is scale, translate, or both.
-
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. -
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
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. -
hasPerspective
boolean hasPerspective() -
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.
-
localAARadius
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.
-
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.- Parameters:
m
- the matrix to compare.- Returns:
true
if this matrix is equivalent to other matrix.
-
clone
-