Transform2
2D affine transform with position, rotation, scale, and center.
Transform2 represents a 2D transform that combines translation, rotation, and non-uniform scaling around an arbitrary center point. It lazily builds a Matrix3 suitable for use in 2D rendering pipelines and UI layouts.
Properties
rotation float
Rotation angle in radians.
cpp
float rotation {0.0f};touched bool
Dirty flag indicating the cached matrix needs to be recomputed.
cpp
bool touched {true};Functions
Returns the 3×3 transform matrix.
Recomputes the underlying matrix if any component has changed since the last call, then returns the cached Matrix3.
cpp
Matrix3 Transform2::Get();Rotate() void
Applies an additional rotation.
cpp
void Transform2::Rotate(float angle);| Parameter | Description |
|---|---|
| angle | Rotation angle in radians to add. |
Scale() void
Scales the transform.
cpp
void Transform2::Scale(const Vector2& value);| Parameter | Description |
|---|---|
| value | Scale factors to apply. |
SetCenter() void
Sets the pivot point used for rotation and scaling.
cpp
void Transform2::SetCenter(const Vector2& center);| Parameter | Description |
|---|---|
| center | New pivot point. |
SetPosition() void
Sets the translation component.
cpp
void Transform2::SetPosition(const Vector2& position);| Parameter | Description |
|---|---|
| position | New position. |
SetRotation() void
Sets the rotation component.
cpp
void Transform2::SetRotation(float rotation);| Parameter | Description |
|---|---|
| rotation | New rotation angle in radians. |
SetScale() void
Sets the scale component.
cpp
void Transform2::SetScale(const Vector2& scale);| Parameter | Description |
|---|---|
| scale | New scale factors. |