Class Matrix3D

java.lang.Object
technology.sola.math.linear.Matrix3D

@NullMarked public class Matrix3D extends Object
Credit to OneLoneCoder for guiding through this implementation
See Also:
  • Constructor Details

    • Matrix3D

      public Matrix3D()
  • Method Details

    • identity

      public static Matrix3D identity()
      Returns:
      the identity matrix instance
    • translate

      public static Matrix3D translate(float tx, float ty)
      Creates a new translation matrix for the desired x,y values.
      Parameters:
      tx - the x translate
      ty - the y translate
      Returns:
      new translation matrix
    • scale

      public static Matrix3D scale(float sx, float sy)
      Creates a new scale matrix for the desired x-axis and y-axis values.
      Parameters:
      sx - the x-axis scale
      sy - the y-axis scale
      Returns:
      new scale matrix
    • rotate

      public static Matrix3D rotate(float radians)
      Creates a new rotation matrix for the desired radians value.
      Parameters:
      radians - the radians for the rotation
      Returns:
      new rotation matrix
    • sheer

      public static Matrix3D sheer(float sx, float sy)
      Creates a new sheer matrix for the desired x,y values.
      Parameters:
      sx - the x sheer
      sy - the y sheer
      Returns:
      new sheer matrix
    • multiply

      public Matrix3D multiply(Matrix3D matrix3D)
      Multiplies two matrices together returning a new instance as the result.
      Parameters:
      matrix3D - the matrix to multiply with
      Returns:
      new matrix with the multiplied result
    • multiply

      public Vector2D multiply(float x, float y)
      Multiples this matrix with a point specified by (x, y).
      Parameters:
      x - the x coordinate of the point
      y - the y coordinate of the point
      Returns:
      a Vector2D of the matrix multiplied with the point
    • multiply

      public Vector2D multiply(Vector2D point)
      Multiplies this matrix with a point.
      Parameters:
      point - the Vector2D to be multiplied with
      Returns:
      a Vector2D of the matrix multiplied with the point
    • invert

      public Matrix3D invert()
      Creates and returns a new Matrix3D that is the inverse of this matrix.
      Returns:
      a new, inverted matrix
    • getBoundingBoxForTransform

      public Rectangle getBoundingBoxForTransform(int width, int height)
      Returns a bounding box for this matrix transform applied to a rectangle with width and height.
      Parameters:
      width - the original width of the rectangle
      height - the original height of the rectangle
      Returns:
      the bounding box after matrix transform is applied