
18.4 The Mathematics of Rotation 467
application of the vector pr oduct in 3D, however, is the construction of vectors at
right ang les to one another. Recall that for two vectors, a and b,thevectora × b will
be at right angles to both.
In 2D it is useful to be able to do the same thing—to generate a vector at right
angles to another. In 2D, things are simpler. For any given vector, there will be only
one other direction that is perpendicular. There are an infinite number of vectors in
that direction, however, so we need to choose one. The following code chooses the
vector made by turning the original vector through 90 degrees counterclockwise:
Vector2D ...