The application can rotate an object either using GpiRotate or by modifying the MATRIXLF structure directly.
The operating system applies a transformation to all points in the source coordinate space. This means that unless an object is drawn about the origin of the source coordinate space, translation occurs when the object is rotated or scaled. GpiRotate enables an application to specify a point, relative to the origin, that is the center of rotation.
The equations for the rotation of an object about the origin (0,0) through an angle (theta), can be written:
x' = x cos (theta) - y sin (theta)
y' = x sin (theta) + y cos (theta)
A negative (theta) value rotates the object clockwise. For clockwise rotation, the rotation equations are:
x' = x cos (theta) + y sin (theta)
y' = -x sin (theta) + y cos (theta)
To rotate an object about some other point (p,q), the following sequence of transformations is required:
Rotation preserves the shape and size of the object.