# 2D Rotation

Example of a 2D rotation through an angle w where the coordinates x, y go into x', y'.
Note that w is positive for a counterclockwise rotation and that that rotation is about
the origin (0, 0).

## Derive the formula for rotation

(old coordinates are (x, y) and the new coordinates are (x', y'))

q = initial angle, f = angle of
rotation.

x = r cos q

y = r sin q

x' = r cos ( q + f ) = r cos q cos f - r sin q
sin f

y' = r sin ( q + w ) = r sin q cos f
+ r cos q sin f

hence:

x' = x cos f - y sin f

y' = y cos f + x sin f

What if we want to rotate about another point rather than the origin, e.g., the center
of an object? Then we have the same problem as with scaling. A solution to this problem is
to perform several transformations rather tnan just one.

Now we could apply the 3 transformations to the object one at a time. But this is
inefficient, especially when the object has many points, as we will see later. It would be
nice to be able to compose the transformations into one and then apply this total
transformation to the object.

Main 2D Modeling page

HyperGraph Table of Contents.

HyperGraph Home page.

Last changed June 02, 1999, G. Scott Owen, owen@siggraph.org