Class AffineTransform

java.lang.Object
technology.sola.engine.graphics.AffineTransform

@NullMarked public class AffineTransform extends Object
AffineTransform represents an affine transformation.
  • Constructor Details

    • AffineTransform

      public AffineTransform()
  • Method Details

    • reset

      public void reset()
      Resets this AffineTransform back to the Matrix3D.identity().
    • translate

      public AffineTransform translate(float tx, float ty)
      Translates by tx, ty.
      Parameters:
      tx - the x translation
      ty - the y translation
      Returns:
      this
    • scale

      public AffineTransform scale(float sx, float sy)
      Scales by sx, sy.
      Parameters:
      sx - the x scale factor
      sy - the y scale factor
      Returns:
      this
    • rotate

      public AffineTransform rotate(float radians)
      Rotates by radians.
      Parameters:
      radians - the radians to rotate the transform
      Returns:
      this
    • sheer

      public AffineTransform sheer(float sx, float sy)
      Sheers by sx, sy.
      Parameters:
      sx - the x sheer
      sy - the y sheer
      Returns:
      this
    • multiply

      public Vector2D multiply(float x, float y)
      Multiplies the AffineTransform with a point (x, y).
      Parameters:
      x - the x coordinate
      y - the y coordinate
      Returns:
      a Vector2D of the transform multiplied with the point
    • multiplyInverse

      public Vector2D multiplyInverse(float x, float y)
      Multiplies the inverse of the AffineTransform with a point (x, y).
      Parameters:
      x - the x coordinate
      y - the y coordinate
      Returns:
      a Vector2D of the inverse transform multiplied with the point
    • getBoundingBoxForTransform

      public Rectangle getBoundingBoxForTransform(int width, int height)
      Returns the bounding box for this 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 transform is applied