Interface Matrix3x2dc
-
- All Known Implementing Classes:
Matrix3x2d,Matrix3x2dStack
public interface Matrix3x2dcInterface to a read-only view of a 3x2 matrix of double-precision floats.- Author:
- Kai Burjack
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description doubledeterminant()Return the determinant of this matrix.booleanequals(Matrix3x2dc m, double delta)Compare the matrix elements ofthismatrix with the given matrix using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.double[]get(double[] arr)Store this matrix into the supplied double array in column-major order.double[]get(double[] arr, int offset)Store this matrix into the supplied double array in column-major order at the given offset.java.nio.ByteBufferget(int index, java.nio.ByteBuffer buffer)Store this matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.DoubleBufferget(int index, java.nio.DoubleBuffer buffer)Store this matrix in column-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.java.nio.ByteBufferget(java.nio.ByteBuffer buffer)Store this matrix in column-major order into the suppliedByteBufferat the current bufferposition.java.nio.DoubleBufferget(java.nio.DoubleBuffer buffer)Store this matrix in column-major order into the suppliedDoubleBufferat the current bufferposition.Matrix3x2dget(Matrix3x2d dest)Get the current values ofthismatrix and store them intodest.double[]get3x3(double[] arr)Store this matrix as an equivalent 3x3 matrix into the supplied double array in column-major order.double[]get3x3(double[] arr, int offset)Store this matrix as an equivalent 3x3 matrix into the supplied double array in column-major order at the given offset.java.nio.ByteBufferget3x3(int index, java.nio.ByteBuffer buffer)Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.DoubleBufferget3x3(int index, java.nio.DoubleBuffer buffer)Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.java.nio.ByteBufferget3x3(java.nio.ByteBuffer buffer)Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedByteBufferat the current bufferposition.java.nio.DoubleBufferget3x3(java.nio.DoubleBuffer buffer)Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedDoubleBufferat the current bufferposition.double[]get4x4(double[] arr)Store this matrix as an equivalent 4x4 matrix into the supplied double array in column-major order.double[]get4x4(double[] arr, int offset)Store this matrix as an equivalent 4x4 matrix into the supplied double array in column-major order at the given offset.java.nio.ByteBufferget4x4(int index, java.nio.ByteBuffer buffer)Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.DoubleBufferget4x4(int index, java.nio.DoubleBuffer buffer)Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.java.nio.ByteBufferget4x4(java.nio.ByteBuffer buffer)Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedByteBufferat the current bufferposition.java.nio.DoubleBufferget4x4(java.nio.DoubleBuffer buffer)Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedDoubleBufferat the current bufferposition.Matrix3x2dcgetToAddress(long address)Store this matrix in column-major order at the given off-heap address.java.nio.ByteBuffergetTransposed(int index, java.nio.ByteBuffer buffer)Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.DoubleBuffergetTransposed(int index, java.nio.DoubleBuffer buffer)Store this matrix in row-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.java.nio.FloatBuffergetTransposed(int index, java.nio.FloatBuffer buffer)Store this matrix in row-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.java.nio.ByteBuffergetTransposed(java.nio.ByteBuffer buffer)Store this matrix in row-major order into the suppliedByteBufferat the current bufferposition.java.nio.DoubleBuffergetTransposed(java.nio.DoubleBuffer buffer)Store this matrix in row-major order into the suppliedDoubleBufferat the current bufferposition.java.nio.FloatBuffergetTransposed(java.nio.FloatBuffer buffer)Store this matrix in row-major order into the suppliedFloatBufferat the current bufferposition.java.nio.ByteBuffergetTransposedFloats(int index, java.nio.ByteBuffer buffer)Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.java.nio.ByteBuffergetTransposedFloats(java.nio.ByteBuffer buffer)Store this matrix as float values in row-major order into the suppliedByteBufferat the current bufferposition.Matrix3x2dinvert(Matrix3x2d dest)Invert thethismatrix by assuming a third row in this matrix of(0, 0, 1)and store the result indest.booleanisFinite()Determine whether all matrix elements are finite floating-point values, that is, they are notNaNand notinfinity.doublem00()Return the value of the matrix element at column 0 and row 0.doublem01()Return the value of the matrix element at column 0 and row 1.doublem10()Return the value of the matrix element at column 1 and row 0.doublem11()Return the value of the matrix element at column 1 and row 1.doublem20()Return the value of the matrix element at column 2 and row 0.doublem21()Return the value of the matrix element at column 2 and row 1.Matrix3x2dmul(Matrix3x2dc right, Matrix3x2d dest)Multiply this matrix by the suppliedrightmatrix by assuming a third row in both matrices of(0, 0, 1)and store the result indest.Matrix3x2dmulLocal(Matrix3x2dc left, Matrix3x2d dest)Pre-multiply this matrix by the suppliedleftmatrix and store the result indest.Vector2dnormalizedPositiveX(Vector2d dir)Obtain the direction of+Xbefore the transformation represented bythisorthogonal matrix is applied.Vector2dnormalizedPositiveY(Vector2d dir)Obtain the direction of+Ybefore the transformation represented bythisorthogonal matrix is applied.Vector2dorigin(Vector2d origin)Obtain the position that gets transformed to the origin bythismatrix.Vector2dpositiveX(Vector2d dir)Obtain the direction of+Xbefore the transformation represented bythismatrix is applied.Vector2dpositiveY(Vector2d dir)Obtain the direction of+Ybefore the transformation represented bythismatrix is applied.Matrix3x2drotate(double ang, Matrix3x2d dest)Apply a rotation transformation to this matrix by rotating the given amount of radians and store the result indest.Matrix3x2drotateAbout(double ang, double x, double y, Matrix3x2d dest)Apply a rotation transformation to this matrix by rotating the given amount of radians about the specified rotation center(x, y)and store the result indest.Matrix3x2drotateLocal(double ang, Matrix3x2d dest)Pre-multiply a rotation to this matrix by rotating the given amount of radians and store the result indest.Matrix3x2drotateTo(Vector2dc fromDir, Vector2dc toDir, Matrix3x2d dest)Apply a rotation transformation to this matrix that rotates the given normalizedfromDirdirection vector to point along the normalizedtoDir, and store the result indest.Matrix3x2dscale(double x, double y, Matrix3x2d dest)Apply scaling to this matrix by scaling the unit axes by the given x and y and store the result indest.Matrix3x2dscale(double xy, Matrix3x2d dest)Apply scaling to this matrix by uniformly scaling the two base axes by the givenxyfactor and store the result indest.Matrix3x2dscale(Vector2dc xy, Matrix3x2d dest)Apply scaling to this matrix by scaling the base axes by the givenxyfactors and store the result indest.Matrix3x2dscale(Vector2fc xy, Matrix3x2d dest)Apply scaling to this matrix by scaling the base axes by the givenxyfactors and store the result indest.Matrix3x2dscaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest)Apply scaling tothismatrix by scaling the base axes by the given sx and sy factors while using(ox, oy)as the scaling origin, and store the result indest.Matrix3x2dscaleAround(double factor, double ox, double oy, Matrix3x2d dest)Apply scaling to this matrix by scaling the base axes by the givenfactorwhile using(ox, oy)as the scaling origin, and store the result indest.Matrix3x2dscaleAroundLocal(double sx, double sy, double ox, double oy, Matrix3x2d dest)Pre-multiply scaling tothismatrix by scaling the base axes by the given sx and sy factors while using the given(ox, oy)as the scaling origin, and store the result indest.Matrix3x2dscaleAroundLocal(double factor, double ox, double oy, Matrix3x2d dest)Pre-multiply scaling to this matrix by scaling the base axes by the givenfactorwhile using(ox, oy)as the scaling origin, and store the result indest.Matrix3x2dscaleLocal(double x, double y, Matrix3x2d dest)Pre-multiply scaling tothismatrix by scaling the base axes by the given x and y factors and store the result indest.Matrix3x2dscaleLocal(double xy, Matrix3x2d dest)Pre-multiply scaling tothismatrix by scaling the two base axes by the givenxyfactor, and store the result indest.booleantestAar(double minX, double minY, double maxX, double maxY)Test whether the given axis-aligned rectangle is partly or completely within or outside of the frustum defined bythismatrix.booleantestCircle(double x, double y, double r)Test whether the given circle is partly or completely within or outside of the frustum defined bythismatrix.booleantestPoint(double x, double y)Test whether the given point(x, y)is within the frustum defined bythismatrix.Vector3dtransform(double x, double y, double z, Vector3d dest)Transform/multiply the given vector(x, y, z)by this matrix and store the result indest.Vector3dtransform(Vector3d v)Transform/multiply the given vector by this matrix by assuming a third row in this matrix of(0, 0, 1)and store the result in that vector.Vector3dtransform(Vector3dc v, Vector3d dest)Transform/multiply the given vector by this matrix and store the result indest.Vector2dtransformDirection(double x, double y, Vector2d dest)Transform/multiply the given 2D-vector(x, y), as if it was a 3D-vector with z=0, by this matrix and store the result indest.Vector2dtransformDirection(Vector2d v)Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result in that vector.Vector2dtransformDirection(Vector2dc v, Vector2d dest)Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result indest.Vector2dtransformPosition(double x, double y, Vector2d dest)Transform/multiply the given 2D-vector(x, y), as if it was a 3D-vector with z=1, by this matrix and store the result indest.Vector2dtransformPosition(Vector2d v)Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by this matrix and store the result in that vector.Vector2dtransformPosition(Vector2dc v, Vector2d dest)Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by this matrix and store the result indest.Matrix3x2dtranslate(double x, double y, Matrix3x2d dest)Apply a translation to this matrix by translating by the given number of units in x and y and store the result indest.Matrix3x2dtranslate(Vector2dc offset, Matrix3x2d dest)Apply a translation to this matrix by translating by the given number of units in x and y, and store the result indest.Matrix3x2dtranslateLocal(double x, double y, Matrix3x2d dest)Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result indest.Matrix3x2dtranslateLocal(Vector2dc offset, Matrix3x2d dest)Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result indest.Vector2dunproject(double winX, double winY, int[] viewport, Vector2d dest)Unproject the given window coordinates(winX, winY)bythismatrix using the specified viewport.Vector2dunprojectInv(double winX, double winY, int[] viewport, Vector2d dest)Unproject the given window coordinates(winX, winY)bythismatrix using the specified viewport.Matrix3x2dview(double left, double right, double bottom, double top, Matrix3x2d dest)Apply a "view" transformation to this matrix that maps the given(left, bottom)and(right, top)corners to(-1, -1)and(1, 1)respectively and store the result indest.double[]viewArea(double[] area)Obtain the extents of the view transformation ofthismatrix and store it inarea.
-
-
-
Method Detail
-
m00
double m00()
Return the value of the matrix element at column 0 and row 0.- Returns:
- the value of the matrix element
-
m01
double m01()
Return the value of the matrix element at column 0 and row 1.- Returns:
- the value of the matrix element
-
m10
double m10()
Return the value of the matrix element at column 1 and row 0.- Returns:
- the value of the matrix element
-
m11
double m11()
Return the value of the matrix element at column 1 and row 1.- Returns:
- the value of the matrix element
-
m20
double m20()
Return the value of the matrix element at column 2 and row 0.- Returns:
- the value of the matrix element
-
m21
double m21()
Return the value of the matrix element at column 2 and row 1.- Returns:
- the value of the matrix element
-
mul
Matrix3x2d mul(Matrix3x2dc right, Matrix3x2d dest)
Multiply this matrix by the suppliedrightmatrix by assuming a third row in both matrices of(0, 0, 1)and store the result indest.If
Misthismatrix andRtherightmatrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the transformation of the right matrix will be applied first!- Parameters:
right- the right operand of the matrix multiplicationdest- will hold the result- Returns:
- dest
-
mulLocal
Matrix3x2d mulLocal(Matrix3x2dc left, Matrix3x2d dest)
Pre-multiply this matrix by the suppliedleftmatrix and store the result indest.If
Misthismatrix andLtheleftmatrix, then the new matrix will beL * M. So when transforming a vectorvwith the new matrix by usingL * M * v, the transformation ofthismatrix will be applied first!- Parameters:
left- the left operand of the matrix multiplicationdest- the destination matrix, which will hold the result- Returns:
- dest
-
determinant
double determinant()
Return the determinant of this matrix.- Returns:
- the determinant
-
invert
Matrix3x2d invert(Matrix3x2d dest)
Invert thethismatrix by assuming a third row in this matrix of(0, 0, 1)and store the result indest.- Parameters:
dest- will hold the result- Returns:
- dest
-
translate
Matrix3x2d translate(double x, double y, Matrix3x2d dest)
Apply a translation to this matrix by translating by the given number of units in x and y and store the result indest.If
Misthismatrix andTthe translation matrix, then the new matrix will beM * T. So when transforming a vectorvwith the new matrix by usingM * T * v, the translation will be applied first!- Parameters:
x- the offset to translate in xy- the offset to translate in ydest- will hold the result- Returns:
- dest
-
translate
Matrix3x2d translate(Vector2dc offset, Matrix3x2d dest)
Apply a translation to this matrix by translating by the given number of units in x and y, and store the result indest.If
Misthismatrix andTthe translation matrix, then the new matrix will beM * T. So when transforming a vectorvwith the new matrix by usingM * T * v, the translation will be applied first!- Parameters:
offset- the offset to translatedest- will hold the result- Returns:
- dest
-
translateLocal
Matrix3x2d translateLocal(Vector2dc offset, Matrix3x2d dest)
Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result indest.If
Misthismatrix andTthe translation matrix, then the new matrix will beT * M. So when transforming a vectorvwith the new matrix by usingT * M * v, the translation will be applied last!- Parameters:
offset- the number of units in x and y by which to translatedest- will hold the result- Returns:
- dest
-
translateLocal
Matrix3x2d translateLocal(double x, double y, Matrix3x2d dest)
Pre-multiply a translation to this matrix by translating by the given number of units in x and y and store the result indest.If
Misthismatrix andTthe translation matrix, then the new matrix will beT * M. So when transforming a vectorvwith the new matrix by usingT * M * v, the translation will be applied last!- Parameters:
x- the offset to translate in xy- the offset to translate in ydest- will hold the result- Returns:
- dest
-
get
Matrix3x2d get(Matrix3x2d dest)
Get the current values ofthismatrix and store them intodest.- Parameters:
dest- the destination matrix- Returns:
- dest
-
get
java.nio.DoubleBuffer get(java.nio.DoubleBuffer buffer)
Store this matrix in column-major order into the suppliedDoubleBufferat the current bufferposition.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which the matrix is stored, use
get(int, DoubleBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
get(int, DoubleBuffer)
-
get
java.nio.DoubleBuffer get(int index, java.nio.DoubleBuffer buffer)Store this matrix in column-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given DoubleBuffer.
- Parameters:
index- the absolute position into the DoubleBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get
java.nio.ByteBuffer get(java.nio.ByteBuffer buffer)
Store this matrix in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
get(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
get(int, ByteBuffer)
-
get
java.nio.ByteBuffer get(int index, java.nio.ByteBuffer buffer)Store this matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
getTransposed
java.nio.DoubleBuffer getTransposed(java.nio.DoubleBuffer buffer)
Store this matrix in row-major order into the suppliedDoubleBufferat the current bufferposition.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which the matrix is stored, use
getTransposed(int, DoubleBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
getTransposed(int, DoubleBuffer)
-
getTransposed
java.nio.DoubleBuffer getTransposed(int index, java.nio.DoubleBuffer buffer)Store this matrix in row-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given DoubleBuffer.
- Parameters:
index- the absolute position into the DoubleBufferbuffer- will receive the values of this matrix in row-major order- Returns:
- the passed in buffer
-
getTransposed
java.nio.ByteBuffer getTransposed(java.nio.ByteBuffer buffer)
Store this matrix in row-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
getTransposed(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
getTransposed(int, ByteBuffer)
-
getTransposed
java.nio.ByteBuffer getTransposed(int index, java.nio.ByteBuffer buffer)Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix in row-major order- Returns:
- the passed in buffer
-
getTransposed
java.nio.FloatBuffer getTransposed(java.nio.FloatBuffer buffer)
Store this matrix in row-major order into the suppliedFloatBufferat the current bufferposition.This method will not increment the position of the given FloatBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
In order to specify the offset into the FloatBuffer at which the matrix is stored, use
getTransposed(int, FloatBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
getTransposed(int, FloatBuffer)
-
getTransposed
java.nio.FloatBuffer getTransposed(int index, java.nio.FloatBuffer buffer)Store this matrix in row-major order into the suppliedFloatBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given FloatBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Parameters:
index- the absolute position into the FloatBufferbuffer- will receive the values of this matrix in row-major order- Returns:
- the passed in buffer
-
getTransposedFloats
java.nio.ByteBuffer getTransposedFloats(java.nio.ByteBuffer buffer)
Store this matrix as float values in row-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
getTransposedFloats(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix as float values in row-major order at its current position- Returns:
- the passed in buffer
- See Also:
getTransposedFloats(int, ByteBuffer)
-
getTransposedFloats
java.nio.ByteBuffer getTransposedFloats(int index, java.nio.ByteBuffer buffer)Store this matrix in row-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
Please note that due to this matrix storing double values those values will potentially lose precision when they are converted to float values before being put into the given FloatBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix as float values in row-major order- Returns:
- the passed in buffer
-
get3x3
java.nio.DoubleBuffer get3x3(java.nio.DoubleBuffer buffer)
Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedDoubleBufferat the current bufferposition.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which the matrix is stored, use
get3x3(int, DoubleBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
get3x3(int, DoubleBuffer)
-
get3x3
java.nio.DoubleBuffer get3x3(int index, java.nio.DoubleBuffer buffer)Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given DoubleBuffer.
- Parameters:
index- the absolute position into the DoubleBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get3x3
java.nio.ByteBuffer get3x3(java.nio.ByteBuffer buffer)
Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
get3x3(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
get3x3(int, ByteBuffer)
-
get3x3
java.nio.ByteBuffer get3x3(int index, java.nio.ByteBuffer buffer)Store this matrix as an equivalent 3x3 matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get4x4
java.nio.DoubleBuffer get4x4(java.nio.DoubleBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedDoubleBufferat the current bufferposition.This method will not increment the position of the given DoubleBuffer.
In order to specify the offset into the DoubleBuffer at which the matrix is stored, use
get4x4(int, DoubleBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
get4x4(int, DoubleBuffer)
-
get4x4
java.nio.DoubleBuffer get4x4(int index, java.nio.DoubleBuffer buffer)Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedDoubleBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given DoubleBuffer.
- Parameters:
index- the absolute position into the DoubleBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
get4x4
java.nio.ByteBuffer get4x4(java.nio.ByteBuffer buffer)
Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedByteBufferat the current bufferposition.This method will not increment the position of the given ByteBuffer.
In order to specify the offset into the ByteBuffer at which the matrix is stored, use
get4x4(int, ByteBuffer), taking the absolute position as parameter.- Parameters:
buffer- will receive the values of this matrix in column-major order at its current position- Returns:
- the passed in buffer
- See Also:
get4x4(int, ByteBuffer)
-
get4x4
java.nio.ByteBuffer get4x4(int index, java.nio.ByteBuffer buffer)Store this matrix as an equivalent 4x4 matrix in column-major order into the suppliedByteBufferstarting at the specified absolute buffer position/index.This method will not increment the position of the given ByteBuffer.
- Parameters:
index- the absolute position into the ByteBufferbuffer- will receive the values of this matrix in column-major order- Returns:
- the passed in buffer
-
getToAddress
Matrix3x2dc getToAddress(long address)
Store this matrix in column-major order at the given off-heap address.This method will throw an
UnsupportedOperationExceptionwhen JOML is used with `-Djoml.nounsafe`.This method is unsafe as it can result in a crash of the JVM process when the specified address range does not belong to this process.
- Parameters:
address- the off-heap address where to store this matrix- Returns:
- this
-
get
double[] get(double[] arr, int offset)Store this matrix into the supplied double array in column-major order at the given offset.- Parameters:
arr- the array to write the matrix values intooffset- the offset into the array- Returns:
- the passed in array
-
get
double[] get(double[] arr)
Store this matrix into the supplied double array in column-major order.In order to specify an explicit offset into the array, use the method
get(double[], int).- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
get(double[], int)
-
get3x3
double[] get3x3(double[] arr, int offset)Store this matrix as an equivalent 3x3 matrix into the supplied double array in column-major order at the given offset.- Parameters:
arr- the array to write the matrix values intooffset- the offset into the array- Returns:
- the passed in array
-
get3x3
double[] get3x3(double[] arr)
Store this matrix as an equivalent 3x3 matrix into the supplied double array in column-major order.In order to specify an explicit offset into the array, use the method
get3x3(double[], int).- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
get3x3(double[], int)
-
get4x4
double[] get4x4(double[] arr, int offset)Store this matrix as an equivalent 4x4 matrix into the supplied double array in column-major order at the given offset.- Parameters:
arr- the array to write the matrix values intooffset- the offset into the array- Returns:
- the passed in array
-
get4x4
double[] get4x4(double[] arr)
Store this matrix as an equivalent 4x4 matrix into the supplied double array in column-major order.In order to specify an explicit offset into the array, use the method
get4x4(double[], int).- Parameters:
arr- the array to write the matrix values into- Returns:
- the passed in array
- See Also:
get4x4(double[], int)
-
scale
Matrix3x2d scale(double x, double y, Matrix3x2d dest)
Apply scaling to this matrix by scaling the unit axes by the given x and y and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
x- the factor of the x componenty- the factor of the y componentdest- will hold the result- Returns:
- dest
-
scale
Matrix3x2d scale(Vector2dc xy, Matrix3x2d dest)
Apply scaling to this matrix by scaling the base axes by the givenxyfactors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xy- the factors of the x and y component, respectivelydest- will hold the result- Returns:
- dest
-
scale
Matrix3x2d scale(Vector2fc xy, Matrix3x2d dest)
Apply scaling to this matrix by scaling the base axes by the givenxyfactors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xy- the factors of the x and y component, respectivelydest- will hold the result- Returns:
- dest
-
scaleLocal
Matrix3x2d scaleLocal(double xy, Matrix3x2d dest)
Pre-multiply scaling tothismatrix by scaling the two base axes by the givenxyfactor, and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!- Parameters:
xy- the factor to scale all two base axes bydest- will hold the result- Returns:
- dest
-
scaleLocal
Matrix3x2d scaleLocal(double x, double y, Matrix3x2d dest)
Pre-multiply scaling tothismatrix by scaling the base axes by the given x and y factors and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!- Parameters:
x- the factor of the x componenty- the factor of the y componentdest- will hold the result- Returns:
- dest
-
scaleAroundLocal
Matrix3x2d scaleAroundLocal(double sx, double sy, double ox, double oy, Matrix3x2d dest)
Pre-multiply scaling tothismatrix by scaling the base axes by the given sx and sy factors while using the given(ox, oy)as the scaling origin, and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!This method is equivalent to calling:
new Matrix3x2d().translate(ox, oy).scale(sx, sy).translate(-ox, -oy).mul(this, dest)- Parameters:
sx- the scaling factor of the x componentsy- the scaling factor of the y componentox- the x coordinate of the scaling originoy- the y coordinate of the scaling origindest- will hold the result- Returns:
- dest
-
scaleAroundLocal
Matrix3x2d scaleAroundLocal(double factor, double ox, double oy, Matrix3x2d dest)
Pre-multiply scaling to this matrix by scaling the base axes by the givenfactorwhile using(ox, oy)as the scaling origin, and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beS * M. So when transforming a vectorvwith the new matrix by usingS * M * v, the scaling will be applied last!This method is equivalent to calling:
new Matrix3x2d().translate(ox, oy).scale(factor).translate(-ox, -oy).mul(this, dest)- Parameters:
factor- the scaling factor for all three axesox- the x coordinate of the scaling originoy- the y coordinate of the scaling origindest- will hold the result- Returns:
- this
-
scale
Matrix3x2d scale(double xy, Matrix3x2d dest)
Apply scaling to this matrix by uniformly scaling the two base axes by the givenxyfactor and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!- Parameters:
xy- the factor for the two componentsdest- will hold the result- Returns:
- dest
- See Also:
scale(double, double, Matrix3x2d)
-
scaleAround
Matrix3x2d scaleAround(double sx, double sy, double ox, double oy, Matrix3x2d dest)
Apply scaling tothismatrix by scaling the base axes by the given sx and sy factors while using(ox, oy)as the scaling origin, and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!This method is equivalent to calling:
translate(ox, oy, dest).scale(sx, sy).translate(-ox, -oy)- Parameters:
sx- the scaling factor of the x componentsy- the scaling factor of the y componentox- the x coordinate of the scaling originoy- the y coordinate of the scaling origindest- will hold the result- Returns:
- dest
-
scaleAround
Matrix3x2d scaleAround(double factor, double ox, double oy, Matrix3x2d dest)
Apply scaling to this matrix by scaling the base axes by the givenfactorwhile using(ox, oy)as the scaling origin, and store the result indest.If
Misthismatrix andSthe scaling matrix, then the new matrix will beM * S. So when transforming a vectorvwith the new matrix by usingM * S * v, the scaling will be applied first!This method is equivalent to calling:
translate(ox, oy, dest).scale(factor).translate(-ox, -oy)- Parameters:
factor- the scaling factor for all three axesox- the x coordinate of the scaling originoy- the y coordinate of the scaling origindest- will hold the result- Returns:
- this
-
transform
Vector3d transform(Vector3d v)
Transform/multiply the given vector by this matrix by assuming a third row in this matrix of(0, 0, 1)and store the result in that vector.- Parameters:
v- the vector to transform and to hold the final result- Returns:
- v
- See Also:
Vector3d.mul(Matrix3x2dc)
-
transform
Vector3d transform(Vector3dc v, Vector3d dest)
Transform/multiply the given vector by this matrix and store the result indest.- Parameters:
v- the vector to transformdest- will contain the result- Returns:
- dest
- See Also:
Vector3d.mul(Matrix3x2dc, Vector3d)
-
transform
Vector3d transform(double x, double y, double z, Vector3d dest)
Transform/multiply the given vector(x, y, z)by this matrix and store the result indest.- Parameters:
x- the x component of the vector to transformy- the y component of the vector to transformz- the z component of the vector to transformdest- will contain the result- Returns:
- dest
-
transformPosition
Vector2d transformPosition(Vector2d v)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by this matrix and store the result in that vector.The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.
In order to store the result in another vector, use
transformPosition(Vector2dc, Vector2d).- Parameters:
v- the vector to transform and to hold the final result- Returns:
- v
- See Also:
transformPosition(Vector2dc, Vector2d),transform(Vector3d)
-
transformPosition
Vector2d transformPosition(Vector2dc v, Vector2d dest)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=1, by this matrix and store the result indest.The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.
In order to store the result in the same vector, use
transformPosition(Vector2d).- Parameters:
v- the vector to transformdest- will hold the result- Returns:
- dest
- See Also:
transformPosition(Vector2d),transform(Vector3dc, Vector3d)
-
transformPosition
Vector2d transformPosition(double x, double y, Vector2d dest)
Transform/multiply the given 2D-vector(x, y), as if it was a 3D-vector with z=1, by this matrix and store the result indest.The given 2D-vector is treated as a 3D-vector with its z-component being 1.0, so it will represent a position/location in 2D-space rather than a direction.
In order to store the result in the same vector, use
transformPosition(Vector2d).- Parameters:
x- the x component of the vector to transformy- the y component of the vector to transformdest- will hold the result- Returns:
- dest
- See Also:
transformPosition(Vector2d),transform(Vector3dc, Vector3d)
-
transformDirection
Vector2d transformDirection(Vector2d v)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result in that vector.The given 2D-vector is treated as a 3D-vector with its z-component being
0.0, so it will represent a direction in 2D-space rather than a position. This method will therefore not take the translation part of the matrix into account.In order to store the result in another vector, use
transformDirection(Vector2dc, Vector2d).- Parameters:
v- the vector to transform and to hold the final result- Returns:
- v
- See Also:
transformDirection(Vector2dc, Vector2d)
-
transformDirection
Vector2d transformDirection(Vector2dc v, Vector2d dest)
Transform/multiply the given 2D-vector, as if it was a 3D-vector with z=0, by this matrix and store the result indest.The given 2D-vector is treated as a 3D-vector with its z-component being
0.0, so it will represent a direction in 2D-space rather than a position. This method will therefore not take the translation part of the matrix into account.In order to store the result in the same vector, use
transformDirection(Vector2d).- Parameters:
v- the vector to transform and to hold the final resultdest- will hold the result- Returns:
- dest
- See Also:
transformDirection(Vector2d)
-
transformDirection
Vector2d transformDirection(double x, double y, Vector2d dest)
Transform/multiply the given 2D-vector(x, y), as if it was a 3D-vector with z=0, by this matrix and store the result indest.The given 2D-vector is treated as a 3D-vector with its z-component being
0.0, so it will represent a direction in 2D-space rather than a position. This method will therefore not take the translation part of the matrix into account.In order to store the result in the same vector, use
transformDirection(Vector2d).- Parameters:
x- the x component of the vector to transformy- the y component of the vector to transformdest- will hold the result- Returns:
- dest
- See Also:
transformDirection(Vector2d)
-
rotate
Matrix3x2d rotate(double ang, Matrix3x2d dest)
Apply a rotation transformation to this matrix by rotating the given amount of radians and store the result indest.If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!- Parameters:
ang- the angle in radiansdest- will hold the result- Returns:
- dest
-
rotateLocal
Matrix3x2d rotateLocal(double ang, Matrix3x2d dest)
Pre-multiply a rotation to this matrix by rotating the given amount of radians and store the result indest.If
Misthismatrix andRthe rotation matrix, then the new matrix will beR * M. So when transforming a vectorvwith the new matrix by usingR * M * v, the rotation will be applied last!Reference: http://en.wikipedia.org
- Parameters:
ang- the angle in radiansdest- will hold the result- Returns:
- dest
-
rotateAbout
Matrix3x2d rotateAbout(double ang, double x, double y, Matrix3x2d dest)
Apply a rotation transformation to this matrix by rotating the given amount of radians about the specified rotation center(x, y)and store the result indest.This method is equivalent to calling:
translate(x, y, dest).rotate(ang).translate(-x, -y)If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!- Parameters:
ang- the angle in radiansx- the x component of the rotation centery- the y component of the rotation centerdest- will hold the result- Returns:
- dest
- See Also:
translate(double, double, Matrix3x2d),rotate(double, Matrix3x2d)
-
rotateTo
Matrix3x2d rotateTo(Vector2dc fromDir, Vector2dc toDir, Matrix3x2d dest)
Apply a rotation transformation to this matrix that rotates the given normalizedfromDirdirection vector to point along the normalizedtoDir, and store the result indest.If
Misthismatrix andRthe rotation matrix, then the new matrix will beM * R. So when transforming a vectorvwith the new matrix by usingM * R * v, the rotation will be applied first!- Parameters:
fromDir- the normalized direction which should be rotate to point alongtoDirtoDir- the normalized destination directiondest- will hold the result- Returns:
- dest
-
view
Matrix3x2d view(double left, double right, double bottom, double top, Matrix3x2d dest)
Apply a "view" transformation to this matrix that maps the given(left, bottom)and(right, top)corners to(-1, -1)and(1, 1)respectively and store the result indest.If
Misthismatrix andOthe orthographic projection matrix, then the new matrix will beM * O. So when transforming a vectorvwith the new matrix by usingM * O * v, the orthographic projection transformation will be applied first!- Parameters:
left- the distance from the center to the left view edgeright- the distance from the center to the right view edgebottom- the distance from the center to the bottom view edgetop- the distance from the center to the top view edgedest- will hold the result- Returns:
- dest
-
origin
Vector2d origin(Vector2d origin)
Obtain the position that gets transformed to the origin bythismatrix. This can be used to get the position of the "camera" from a given view transformation matrix.This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).invertAffine(); inv.transform(origin.set(0, 0));
- Parameters:
origin- will hold the position transformed to the origin- Returns:
- origin
-
viewArea
double[] viewArea(double[] area)
Obtain the extents of the view transformation ofthismatrix and store it inarea. This can be used to determine which region of the screen (i.e. the NDC space) is covered by the view.- Parameters:
area- will hold the view area as[minX, minY, maxX, maxY]- Returns:
- area
-
positiveX
Vector2d positiveX(Vector2d dir)
Obtain the direction of+Xbefore the transformation represented bythismatrix is applied.This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to
+Xbythismatrix.This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).invert(); inv.transformDirection(dir.set(1, 0)).normalize();
Ifthisis already an orthogonal matrix, then consider usingnormalizedPositiveX(Vector2d)instead.Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
normalizedPositiveX
Vector2d normalizedPositiveX(Vector2d dir)
Obtain the direction of+Xbefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to
+Xbythismatrix.This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).transpose(); inv.transformDirection(dir.set(1, 0));
Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+X- Returns:
- dir
-
positiveY
Vector2d positiveY(Vector2d dir)
Obtain the direction of+Ybefore the transformation represented bythismatrix is applied.This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to
+Ybythismatrix.This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).invert(); inv.transformDirection(dir.set(0, 1)).normalize();
Ifthisis already an orthogonal matrix, then consider usingnormalizedPositiveY(Vector2d)instead.Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
normalizedPositiveY
Vector2d normalizedPositiveY(Vector2d dir)
Obtain the direction of+Ybefore the transformation represented bythisorthogonal matrix is applied. This method only produces correct results ifthisis an orthogonal matrix.This method uses the rotation component of the left 2x2 submatrix to obtain the direction that is transformed to
+Ybythismatrix.This method is equivalent to the following code:
Matrix3x2d inv = new Matrix3x2d(this).transpose(); inv.transformDirection(dir.set(0, 1));
Reference: http://www.euclideanspace.com
- Parameters:
dir- will hold the direction of+Y- Returns:
- dir
-
unproject
Vector2d unproject(double winX, double winY, int[] viewport, Vector2d dest)
Unproject the given window coordinates(winX, winY)bythismatrix using the specified viewport.This method first converts the given window coordinates to normalized device coordinates in the range
[-1..1]and then transforms those NDC coordinates by the inverse ofthismatrix.As a necessary computation step for unprojecting, this method computes the inverse of
thismatrix. In order to avoid computing the matrix inverse with every invocation, the inverse ofthismatrix can be built once outside usinginvert(Matrix3x2d)and then the methodunprojectInv()can be invoked on it.- Parameters:
winX- the x-coordinate in window coordinates (pixels)winY- the y-coordinate in window coordinates (pixels)viewport- the viewport described by[x, y, width, height]dest- will hold the unprojected position- Returns:
- dest
- See Also:
unprojectInv(double, double, int[], Vector2d),invert(Matrix3x2d)
-
unprojectInv
Vector2d unprojectInv(double winX, double winY, int[] viewport, Vector2d dest)
Unproject the given window coordinates(winX, winY)bythismatrix using the specified viewport.This method differs from
unproject()in that it assumes thatthisis already the inverse matrix of the original projection matrix. It exists to avoid recomputing the matrix inverse with every invocation.- Parameters:
winX- the x-coordinate in window coordinates (pixels)winY- the y-coordinate in window coordinates (pixels)viewport- the viewport described by[x, y, width, height]dest- will hold the unprojected position- Returns:
- dest
- See Also:
unproject(double, double, int[], Vector2d)
-
testPoint
boolean testPoint(double x, double y)Test whether the given point(x, y)is within the frustum defined bythismatrix.This method assumes
thismatrix to be a transformation from any arbitrary coordinate system/spaceMinto standard OpenGL clip space and tests whether the given point with the coordinates(x, y, z)given in spaceMis within the clip space.Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
- Parameters:
x- the x-coordinate of the pointy- the y-coordinate of the point- Returns:
trueif the given point is inside the frustum;falseotherwise
-
testCircle
boolean testCircle(double x, double y, double r)Test whether the given circle is partly or completely within or outside of the frustum defined bythismatrix.This method assumes
thismatrix to be a transformation from any arbitrary coordinate system/spaceMinto standard OpenGL clip space and tests whether the given sphere with the coordinates(x, y, z)given in spaceMis within the clip space.Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix
- Parameters:
x- the x-coordinate of the circle's centery- the y-coordinate of the circle's centerr- the circle's radius- Returns:
trueif the given circle is partly or completely inside the frustum;falseotherwise
-
testAar
boolean testAar(double minX, double minY, double maxX, double maxY)Test whether the given axis-aligned rectangle is partly or completely within or outside of the frustum defined bythismatrix. The rectangle is specified via its min and max corner coordinates.This method assumes
thismatrix to be a transformation from any arbitrary coordinate system/spaceMinto standard OpenGL clip space and tests whether the given axis-aligned rectangle with its minimum corner coordinates(minX, minY, minZ)and maximum corner coordinates(maxX, maxY, maxZ)given in spaceMis within the clip space.Reference: Efficient View Frustum Culling
Reference: Fast Extraction of Viewing Frustum Planes from the World-View-Projection Matrix- Parameters:
minX- the x-coordinate of the minimum cornerminY- the y-coordinate of the minimum cornermaxX- the x-coordinate of the maximum cornermaxY- the y-coordinate of the maximum corner- Returns:
trueif the axis-aligned box is completely or partly inside of the frustum;falseotherwise
-
equals
boolean equals(Matrix3x2dc m, double delta)
Compare the matrix elements ofthismatrix with the given matrix using the givendeltaand return whether all of them are equal within a maximum difference ofdelta.Please note that this method is not used by any data structure such as
ArrayListHashSetorHashMapand their operations, such asArrayList.contains(Object)orHashSet.remove(Object), since those data structures only use theObject.equals(Object)andObject.hashCode()methods.- Parameters:
m- the other matrixdelta- the allowed maximum difference- Returns:
truewhether all of the matrix elements are equal;falseotherwise
-
isFinite
boolean isFinite()
Determine whether all matrix elements are finite floating-point values, that is, they are notNaNand notinfinity.- Returns:
trueif all components are finite floating-point values;falseotherwise
-
-