NormalTransformable

Decomposed transform defined by a position, a rotation, and a scale.

This template is provided for convenience, on top of Transformable (and Transform).

Transform, as a low-level class, offers a great level of flexibility but it is not always convenient to manage. Indeed, one can easily combine any kind of operation, such as a translation followed by a rotation followed by a scaling, but once the result transform is built, there's no way to go backward and, let's say, change only the rotation without modifying the translation and scaling.

The entire transform must be recomputed, which means that you need to retrieve the initial translation and scale factors as well, and combine them the same way you did before updating the rotation. This is a tedious operation, and it requires to store all the individual components of the final transform.

That's exactly what Transformable was written for: it hides these variables and the composed transform behind an easy to use interface. You can set or get any of the individual components without worrying about the others. It also provides the composed transform (as a Transform), and keeps it up-to-date.

Members

Functions

getInverseTransform
const(Transform) getInverseTransform()

Get the inverse of the combined transform of the object.

getTransform
const(Transform) getTransform()

Get the combined transform of the object.

move
void move(Vector2f offset)

Move the object by a given offset.

Properties

origin
Vector2f origin [@property setter]

The local origin of the object.

origin
Vector2f origin [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
position
Vector2f position [@property setter]

The position of the object. The default is (0, 0).

position
Vector2f position [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
rotation
float rotation [@property setter]

The orientation of the object, in degrees. The default is 0 degrees.

rotation
float rotation [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
scale
Vector2f scale [@property setter]

The scale factors of the object. The default is (1, 1).

scale
Vector2f scale [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

See Also

Meta

Authors

Laurent Gomila, Jeremy DeHaan