Define a 3x3 transform matrix.
1 // define a translation transform 2 Transform translation; 3 translation.translate(20, 50); 4 5 // define a rotation transform 6 Transform rotation; 7 rotation.rotate(45); 8 9 // combine them 10 Transform transform = translation * rotation; 11 12 // use the result to transform stuff... 13 Vector2f point = transform.transformPoint(Vector2f(10, 20)); 14 FloatRect rect = transform.transformRect(FloatRect(0, 0, 10, 100));
$(TRANSFORMABLE_LINK), $(RENDERSTATES_LINK)
A $(U 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).