Package util
Class Transform
java.lang.Object
util.Transform
Represents the position in X and Y coordinates, rotation and the scale (width and height)
-
Field Summary
-
Constructor Summary
ConstructorDescriptionCreates a new empty transform.Transform
(float x, float y, float w, float h) Transform
(float x, float y, float r, float w, float h) Transform
(org.joml.Vector2f position) If only the position is passed, the scale is not, scale is created as an empty Vector2f.Transform
(org.joml.Vector2f position, float rotation) If only the position is passed, the scale is not, scale is created as an empty Vector2f.Transform
(org.joml.Vector2f position, float rotation, org.joml.Vector2f scale) Transform
(org.joml.Vector2f position, org.joml.Vector2f scale) Create a copy of a transform instance -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRotationDegree
(float r) void
addRotationRadians
(float r) void
addX
(float x) void
addY
(float y) copy()
void
Takes a reference to an external transform, and copies this physics.Transform to it.boolean
Checks to see if to Transforms are equal.float
org.joml.Vector2f
float
float
org.joml.Vector2f
getScale()
float
getWidth()
float
getX()
float
getY()
void
setPosition
(org.joml.Vector2f position) void
setRotation
(float r) void
setRotationRadians
(float r) void
setScale
(org.joml.Vector2f scale) void
setX
(float x) void
setY
(float y)
-
Field Details
-
scale
public org.joml.Vector2f scale
-
-
Constructor Details
-
Transform
public Transform()Creates a new empty 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 Vector2frotation
- 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 Vector2fscale
- 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 Vector2frotation
- Rotation of the object in degreesscale
- 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 objecty
- Y coordinate of the objectw
- width of the objecth
- height of the object
-
Transform
public Transform(float x, float y, float r, float w, float h) - Parameters:
x
- X coordinate of the objecty
- Y coordinate of the objectr
- Rotation of the object in degreesw
- width of the objecth
- height of the object
-
-
Method Details
-
copy
- Returns:
- Returns a new transform which is identical to this object, can be used to copy into a new physics.Transform object.
-
copy
Takes a reference to an external transform, and copies this physics.Transform to it.- Parameters:
to
- The physics.Transform to be changed.
-
equals
Checks to see if to Transforms are equal. -
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)
-