Transform

Define a 3x3 transform matrix.

A Transform specifies how to translate, rotate, scale, shear, project, whatever things.

In mathematical terms, it defines how to transform a coordinate system into another.

For example, if you apply a rotation transform to a sprite, the result will be a rotated sprite. And anything that is transformed by this rotation transform will be rotated the same way, according to its initial position.

Transforms are typically used for drawing. But they can also be used for any computation that requires to transform points between the local and global coordinate systems of an entity (like collision detection).

Constructors

this
this(float a00, float a01, float a02, float a10, float a11, float a12, float a20, float a21, float a22)

Construct a 3x3 matrix.

this
this(float[9] newMatrix)
Undocumented in source.

Members

Functions

combine
void combine(Transform otherTransform)

Combine the current transform with another one.

getInverse
Transform getInverse()

Return the inverse of the transform.

getMatrix
const(float)[] getMatrix()

Return the transform as a 4x4 matrix.

opBinary
Transform opBinary(Vector2f vector)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
Transform opBinary(Transform rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
Transform opOpAssign(Transform rhs)
Undocumented in source. Be warned that the author may not have intended to support it.
rotate
void rotate(float angle)

Combine the current transform with a rotation.

rotate
void rotate(float angle, float centerX, float centerY)

Combine the current transform with a rotation.

scale
void scale(float scaleX, float scaleY)

Combine the current transform with a scaling.

scale
void scale(float scaleX, float scaleY, float centerX, float centerY)

Combine the current transform with a scaling.

toString
string toString()
Undocumented in source. Be warned that the author may not have intended to support it.
transformPoint
Vector2f transformPoint(Vector2f point)

Transform a 2D point.

transformRect
FloatRect transformRect(const(FloatRect) rect)

Transform a rectangle.

translate
void translate(float x, float y)

Combine the current transform with a translation.

Static variables

Identity
const(Transform) Identity;

Indentity transform (does nothing).

Variables

m_matrix
float[9] m_matrix;
Undocumented in source.

See Also

Meta

Authors

Laurent Gomila, Jeremy DeHaan