Class Matrix2f

java.lang.Object
dev.prozilla.pine.common.math.matrix.Matrix2f

public class Matrix2f extends Object
Represents a 2x2-Matrix. GLSL equivalent to mat2.
  • Constructor Details

    • Matrix2f

      public Matrix2f()
      Creates a 2x2 identity matrix.
    • Matrix2f

      public Matrix2f(Vector2f col1, Vector2f col2)
      Creates a 2x2 matrix with specified columns.
      Parameters:
      col1 - Vector with values of the first column
      col2 - Vector with values of the second column
  • Method Details

    • setIdentity

      public final void setIdentity()
      Sets this matrix to the identity matrix.
    • add

      public Matrix2f add(Matrix2f other)
      Adds this matrix to another matrix.
      Parameters:
      other - The other matrix
      Returns:
      Sum of this matrix and the other matrix
    • negate

      public Matrix2f negate()
      Negates this matrix.
      Returns:
      Negated matrix
    • subtract

      public Matrix2f subtract(Matrix2f other)
      Subtracts this matrix from another matrix.
      Parameters:
      other - The other matrix
      Returns:
      Difference of this matrix and the other matrix
    • multiply

      public Matrix2f multiply(float scalar)
      Multiplies this matrix with a scalar.
      Parameters:
      scalar - The scalar
      Returns:
      Scalar product of this matrix and the scalar
    • multiply

      public Vector2f multiply(Vector2f vector)
      Multiplies this matrix to a vector.
      Parameters:
      vector - The vector
      Returns:
      Vector product of this matrix and the vector
    • multiply

      public Matrix2f multiply(Matrix2f other)
      Multiplies this matrix with another matrix.
      Parameters:
      other - The other matrix
      Returns:
      Matrix product of this matrix and the other matrix
    • transpose

      public Matrix2f transpose()
      Transposes this matrix.
      Returns:
      Transposed matrix
    • toBuffer

      public void toBuffer(FloatBuffer buffer)
      Stores this matrix in a given Buffer.
      Parameters:
      buffer - The buffer to store this matrix in