Transformations

To transform the entire group, apply a transformation to the top-most group in the hierarchy. To transform only a part of the entire group, apply a transformation to the appropriate nested group. You can, of course, always transform any graphic before you adopt it into its group.

In the wagon example, a translation is applied to the wagon group to make the wagon body and four wheels move a specified distance. A rotation is applied to each wheel group so that the wheels rotate in addition to the translation.

During the top-down and depth-first traversal that happens when the entire group is drawn, the TGraphicGroup transformation functions recursively call the transformation functions of the adopted groups and graphics. The transformation matrix of the parent is postconcatenated with the matrix of the child. For example, the transformation and rotation matrix for the wagon wheels is found by multiplying the wagon group transformation matrix by the wagon wheel rotation matrix as follows:

( ( wagon wheel rotation matrix ) * ( wagon group translation matrix ) )


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker