Class Matrix3f
- java.lang.Object
-
- net.lax1dude.eaglercraft.v1_8.vector.Matrix
-
- net.lax1dude.eaglercraft.v1_8.vector.Matrix3f
-
- All Implemented Interfaces:
java.io.Serializable
public class Matrix3f extends Matrix implements java.io.Serializable
Holds a 3x3 matrix.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Matrix3f()Constructor for Matrix3f.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Matrix3fadd(Matrix3f left, Matrix3f right, Matrix3f dest)Add two matrices together and place the result in a third matrix.floatdeterminant()static booleanequal(Matrix3f a, Matrix3f b)booleanequals(java.lang.Object m)Matrixinvert()Invert this matrixstatic Matrix3finvert(Matrix3f src, Matrix3f dest)Invert the source matrix and put the result into the destination matrixMatrixload(FloatBuffer buf)Load from a float buffer.Matrix3fload(Matrix3f src)Load from another matrixstatic Matrix3fload(Matrix3f src, Matrix3f dest)Copy source matrix to destination matrixMatrixloadTranspose(FloatBuffer buf)Load from a float buffer.static Matrix3fmul(Matrix3f left, Matrix3f right, Matrix3f dest)Multiply the right matrix by the left and place the result in a third matrix.Matrixnegate()Negate this matrixMatrix3fnegate(Matrix3f dest)Negate this matrix and place the result in a destination matrix.static Matrix3fnegate(Matrix3f src, Matrix3f dest)Negate the source matrix and place the result in the destination matrix.MatrixsetIdentity()Set this matrix to be the identity matrix.static Matrix3fsetIdentity(Matrix3f m)Set the matrix to be the identity matrix.MatrixsetZero()Set this matrix to 0.static Matrix3fsetZero(Matrix3f m)Set the matrix matrix to 0.Matrixstore(float[] buf)Matrixstore(FloatBuffer buf)Store this matrix in a float buffer.MatrixstoreTranspose(FloatBuffer buf)Store this matrix in a float buffer.static Matrix3fsub(Matrix3f left, Matrix3f right, Matrix3f dest)Subtract the right matrix from the left and place the result in a third matrix.java.lang.StringtoString()Returns a string representation of this matrixstatic Vector3ftransform(Matrix3f left, Vector3f right, Vector3f dest)Transform a Vector by a matrix and return the result in a destination vector.Matrixtranspose()Transpose this matrixMatrix3ftranspose(Matrix3f dest)Transpose this matrix and place the result in another matrixstatic Matrix3ftranspose(Matrix3f src, Matrix3f dest)Transpose the source matrix and place the result into the destination matrix
-
-
-
Method Detail
-
load
public Matrix3f load(Matrix3f src)
Load from another matrix- Parameters:
src- The source matrix- Returns:
- this
-
load
public static Matrix3f load(Matrix3f src, Matrix3f dest)
Copy source matrix to destination matrix- Parameters:
src- The source matrixdest- The destination matrix, or null of a new matrix is to be created- Returns:
- The copied matrix
-
load
public Matrix load(FloatBuffer buf)
Load from a float buffer. The buffer stores the matrix in column major (OpenGL) order.
-
loadTranspose
public Matrix loadTranspose(FloatBuffer buf)
Load from a float buffer. The buffer stores the matrix in row major (maths) order.- Specified by:
loadTransposein classMatrix- Parameters:
buf- A float buffer to read from- Returns:
- this
-
store
public Matrix store(FloatBuffer buf)
Store this matrix in a float buffer. The matrix is stored in column major (openGL) order.
-
store
public Matrix store(float[] buf)
-
storeTranspose
public Matrix storeTranspose(FloatBuffer buf)
Store this matrix in a float buffer. The matrix is stored in row major (maths) order.- Specified by:
storeTransposein classMatrix- Parameters:
buf- The buffer to store this matrix in- Returns:
- this
-
add
public static Matrix3f add(Matrix3f left, Matrix3f right, Matrix3f dest)
Add two matrices together and place the result in a third matrix.- Parameters:
left- The left source matrixright- The right source matrixdest- The destination matrix, or null if a new one is to be created- Returns:
- the destination matrix
-
sub
public static Matrix3f sub(Matrix3f left, Matrix3f right, Matrix3f dest)
Subtract the right matrix from the left and place the result in a third matrix.- Parameters:
left- The left source matrixright- The right source matrixdest- The destination matrix, or null if a new one is to be created- Returns:
- the destination matrix
-
mul
public static Matrix3f mul(Matrix3f left, Matrix3f right, Matrix3f dest)
Multiply the right matrix by the left and place the result in a third matrix.- Parameters:
left- The left source matrixright- The right source matrixdest- The destination matrix, or null if a new one is to be created- Returns:
- the destination matrix
-
transform
public static Vector3f transform(Matrix3f left, Vector3f right, Vector3f dest)
Transform a Vector by a matrix and return the result in a destination vector.- Parameters:
left- The left matrixright- The right vectordest- The destination vector, or null if a new one is to be created- Returns:
- the destination vector
-
transpose
public Matrix transpose()
Transpose this matrix
-
transpose
public Matrix3f transpose(Matrix3f dest)
Transpose this matrix and place the result in another matrix- Parameters:
dest- The destination matrix or null if a new matrix is to be created- Returns:
- the transposed matrix
-
transpose
public static Matrix3f transpose(Matrix3f src, Matrix3f dest)
Transpose the source matrix and place the result into the destination matrix- Parameters:
src- The source matrix to be transposeddest- The destination matrix or null if a new matrix is to be created- Returns:
- the transposed matrix
-
determinant
public float determinant()
- Specified by:
determinantin classMatrix- Returns:
- the determinant of the matrix
-
toString
public java.lang.String toString()
Returns a string representation of this matrix- Overrides:
toStringin classjava.lang.Object
-
invert
public Matrix invert()
Invert this matrix
-
invert
public static Matrix3f invert(Matrix3f src, Matrix3f dest)
Invert the source matrix and put the result into the destination matrix- Parameters:
src- The source matrix to be inverteddest- The destination matrix, or null if a new one is to be created- Returns:
- The inverted matrix if successful, null otherwise
-
negate
public Matrix3f negate(Matrix3f dest)
Negate this matrix and place the result in a destination matrix.- Parameters:
dest- The destination matrix, or null if a new matrix is to be created- Returns:
- the negated matrix
-
negate
public static Matrix3f negate(Matrix3f src, Matrix3f dest)
Negate the source matrix and place the result in the destination matrix.- Parameters:
src- The source matrixdest- The destination matrix, or null if a new matrix is to be created- Returns:
- the negated matrix
-
setIdentity
public Matrix setIdentity()
Set this matrix to be the identity matrix.- Specified by:
setIdentityin classMatrix- Returns:
- this
-
setIdentity
public static Matrix3f setIdentity(Matrix3f m)
Set the matrix to be the identity matrix.- Parameters:
m- The matrix to be set to the identity- Returns:
- m
-
setZero
public Matrix setZero()
Set this matrix to 0.
-
setZero
public static Matrix3f setZero(Matrix3f m)
Set the matrix matrix to 0.- Parameters:
m- The matrix to be set to 0- Returns:
- m
-
equals
public boolean equals(java.lang.Object m)
- Overrides:
equalsin classjava.lang.Object
-
-