Class Matrix2f
java.lang.Object
dev.prozilla.pine.common.math.matrix.Matrix2f
Represents a 2x2-Matrix. GLSL equivalent to mat2.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds this matrix to another matrix.multiply
(float scalar) Multiplies this matrix with a scalar.Multiplies this matrix with another matrix.Multiplies this matrix to a vector.negate()
Negates this matrix.final void
Sets this matrix to the identity matrix.Subtracts this matrix from another matrix.void
toBuffer
(FloatBuffer buffer) Stores this matrix in a given Buffer.Transposes this matrix.
-
Constructor Details
-
Matrix2f
public Matrix2f()Creates a 2x2 identity matrix. -
Matrix2f
Creates a 2x2 matrix with specified columns.- Parameters:
col1
- Vector with values of the first columncol2
- Vector with values of the second column
-
-
Method Details
-
setIdentity
public final void setIdentity()Sets this matrix to the identity matrix. -
add
Adds this matrix to another matrix.- Parameters:
other
- The other matrix- Returns:
- Sum of this matrix and the other matrix
-
negate
Negates this matrix.- Returns:
- Negated matrix
-
subtract
Subtracts this matrix from another matrix.- Parameters:
other
- The other matrix- Returns:
- Difference of this matrix and the other matrix
-
multiply
Multiplies this matrix with a scalar.- Parameters:
scalar
- The scalar- Returns:
- Scalar product of this matrix and the scalar
-
multiply
Multiplies this matrix to a vector.- Parameters:
vector
- The vector- Returns:
- Vector product of this matrix and the vector
-
multiply
Multiplies this matrix with another matrix.- Parameters:
other
- The other matrix- Returns:
- Matrix product of this matrix and the other matrix
-
transpose
Transposes this matrix.- Returns:
- Transposed matrix
-
toBuffer
Stores this matrix in a given Buffer.- Parameters:
buffer
- The buffer to store this matrix in
-