Package util

Class Transform

java.lang.Object
util.Transform

public class Transform extends Object
Represents the position in X and Y coordinates, rotation and the scale (width and height)
  • Field Details

    • scale

      public org.joml.Vector2f scale
  • Constructor Details

    • Transform

      public Transform()
      Creates a new empty transform.
    • Transform

      public Transform(Transform transform)
      Create a copy of a transform instance
      Parameters:
      transform - the transform instance
    • Transform

      public Transform(org.joml.Vector2f position)
      If only the position is passed, the scale is not, scale is created as an empty Vector2f.
      Parameters:
      position - X and Y coordinates as a Vector2f
    • Transform

      public Transform(org.joml.Vector2f position, float rotation)
      If only the position is passed, the scale is not, scale is created as an empty Vector2f.
      Parameters:
      position - X and Y coordinates as a Vector2f
      rotation - Rotation of the object in degrees
    • Transform

      public Transform(org.joml.Vector2f position, org.joml.Vector2f scale)
      Parameters:
      position - X and Y coordinates as a Vector2f
      scale - scale (width and height) of the object as a Vector2f
    • Transform

      public Transform(org.joml.Vector2f position, float rotation, org.joml.Vector2f scale)
      Parameters:
      position - X and Y coordinates as a Vector2f
      rotation - Rotation of the object in degrees
      scale - scale (width and height) of the object as a Vector2f
    • Transform

      public Transform(float x, float y, float w, float h)
      Parameters:
      x - X coordinate of the object
      y - Y coordinate of the object
      w - width of the object
      h - height of the object
    • Transform

      public Transform(float x, float y, float r, float w, float h)
      Parameters:
      x - X coordinate of the object
      y - Y coordinate of the object
      r - Rotation of the object in degrees
      w - width of the object
      h - height of the object
  • Method Details

    • copy

      public Transform copy()
      Returns:
      Returns a new transform which is identical to this object, can be used to copy into a new physics.Transform object.
    • copy

      public void copy(Transform to)
      Takes a reference to an external transform, and copies this physics.Transform to it.
      Parameters:
      to - The physics.Transform to be changed.
    • equals

      public boolean equals(Object o)
      Checks to see if to Transforms are equal.
      Overrides:
      equals in class Object
      Parameters:
      o - Transform to be checked for equality against this instance of util.Transform.
      Returns:
      Returns true if instances are the same, otherwise returns false.
    • getX

      public float getX()
    • getY

      public float getY()
    • setY

      public void setY(float y)
    • setX

      public void setX(float x)
    • addY

      public void addY(float y)
    • addX

      public void addX(float x)
    • getWidth

      public float getWidth()
    • getHeight

      public float getHeight()
    • getRotation

      public float getRotation()
    • setRotation

      public void setRotation(float r)
    • setRotationRadians

      public void setRotationRadians(float r)
    • getRotationRadians

      public float getRotationRadians()
    • addRotationDegree

      public void addRotationDegree(float r)
    • addRotationRadians

      public void addRotationRadians(float r)
    • getPosition

      public org.joml.Vector2f getPosition()
    • setPosition

      public void setPosition(org.joml.Vector2f position)
    • getScale

      public org.joml.Vector2f getScale()
    • setScale

      public void setScale(org.joml.Vector2f scale)