Game Development Reference

In-Depth Information

1.3.5 Wrapping up Rotations

Remember that so far we are able to perform rotations around the origin, however, often

we want to rotate points around an arbitrary point. To do this, we start by translating the

point around which we wish to rotate to the origin, once there, we apply the rotation to the

points we wish to transform and finally we translate them back to their original point.

Figure 19- Rotation must be done relative to the object's local space.

The first step is to translate
p
to the origin, we can do this be translating by the negated

valueof
p
,thisbringsthesquaretotheorigin.Onceattheoriginweapplytherotation R(π/

4) which gives the square a 45 degree clockwise rotation, once rotated, we can translate

back by
p
which brings us back to our initial origin.

The end result of this operation is the rotation about an arbitrary axis as we needed.

1.3.6 Scale

Whendiscussingscale,it'seasiertoimagineashaperatherthanasinglepoint.Scalerefers

to a factor by which we can grow or shrink the given shape. We can do it uniformly across