Group Transformations
A group is composed of zero to many shapes. Because a group is a shape, this composition relationship can nest recursively. (A group with zero shapes is degenerate; it produces no user-visible output. A group with one shape is also degenerate; it has no representational power beyond that of the one shape.)
The definition of a group transformation is identical to that of a shape transformation, except that in place of the pre-transform bounding box of a shape, we use the union of all of its children prior to their individual rotations. To summarize, a group transformation is the following sequence of operations:
The translation and scaling required to transform the union of the children's bounding boxes to a rectangle defined by the group's offset and extent attributes.
A flipped about that bounding box according to the
@flipH
and@flipV
attributes.A rotation about the center of that bounding box according to the
@rot
attribute.
To render a simple shape that is inside a group hierarchy, the renderer does not simply apply the shape transformation and all parent group transformations to the original shape. Instead (see §5.7.5), it applies the transformation equal to the following sequence of operations:
Horizontal scaling and flipping by a factor equal to the product of the horizontal scalings and flips in its own transformation and those of its parents.
Vertical scaling and flipping by a factor equal to the product of the vertical scalings and flips in its own transformation and those of its parents.
Rotation by an amount equal to the sum of the rotations in its own transformation and those of its parents.
Translation such that its center coincides with the point obtained by applying the shape transformation and all parent group transformations to the shape's original center.
Because of the similarity with the transformation pipeline for a shape, the forthcoming subsections primarily cover illustrative examples.