When constructing complex shapes, it is often convenient to define the shape as simpler shapes and then combining the simpler shapes into the complex shape ^{[2]}. Shape is a subclass of Segment. This makes it possible to combine simple shapes into more complex ones in Bifrost: shapes can be treated as segments. Notice, that it was not shown in the segment hierarchy figure that Shape is a subclass of Segment ^{[3]}.
The shape to be combined with another shape will be called the source shape, and the shape that receives the source shape will be known as the destination shape. Shapes inside another shape is referred to as subshapes. Four different semantics are possible for combining two shapes:
All operations make a copy of the source shape, and use this copy in the operation. It is important to notice that it is not all kinds of shapes that can be used as source shapes in all of the above four ways of combining shapes: the first three cannot take as argument a shape that only consist of circular spline segments. The reason is that a circular spline segment does not have a welldefined FirstPoint or a LastPoint. CombineShape cannot take an open shape as argument if it is open itself.
A shape is defined in its own coordinate system, which defaults to the CCS coordinate system. A shape has only one coordinate system, implying that all subshapes of a shape are defined in the same coordinate system as the destination shape itself. This is done by transforming the control points of the source shape into destination shape coordinates when shapes are combined.
The reason for only having one coordinate system for a shape is to limit the computing overhead and complication that would otherwise result by defining shapes with many coordinate systems within the same shape. This restriction does not reduce the power of the shape construction language, since nothing is gained by having more than one coordinate system in the same shape. Shapes in different graphical objects may each have different coordinate systems related to the graphical objects.
For each combination operation, there are four cases to consider, depending on the state of the source shape and of the destination shape:
Each case is illustrated with examples in the description of each combination operation below. The underlying philosophy of the four shape combination operations is to have consistent semantics in an operation. This can result in some combinations of shapes that do not seem useful. The most useful combinations are:
The source shape is automatically translated in such a way that FirstPoint comes to coincide with the LastPoint of the destination shape. After the operation the following two statements holds:
In the examples below, FirstPoint of the source shape, LastPoint of the destination shape, and LastPoint of the resulting shape are marked with bullets ().
Notice, that in the two cases where the source shape is closed, FirstPoint and LastPoint coincide, which means that the LastPoint of the resulting shape remains unchanged (i.e. the same as LastPoint of the destination shape).
The supplied transformation matrix transforms the source shape into the coordinate system of the destination shape. LastPoint of the source shape is connected to the FirstPoint of the destination shape with a line segment. After the operation the following statement holds:
In the examples below, FirstPoint of the source shape, LastPoint of the destination shape, and LastPoint of the resulting shape are marked with bullets. In all four cases the same transformation matrix is used. It performs rotation, scaling, and translation of the source shape.
Notice, that in the two cases where the source shape is closed, FirstPoint and LastPoint coincide, which means that LastPoint of the resulting shape remains unchanged (i.e. the same as LastPoint of the destination shape). Notice also, that when both the source and the destination shapes are closed the resulting shape is open (FirstPoint <> LastPoint).
The supplied transformation matrix transforms the source shape into the coordinate system of the destination shape. LastPoint of the source shape is connected to the FirstPoint of the destination shape with a spline segment. After the operation the following statement becomes true:
In the examples below, FirstPoint of the source shape, LastPoint of the destination shape, and LastPoint of the resulting shape are marked with bullets. In all four cases the same transformation matrix is used. It performs rotation, scaling, and translation of the source shape.
Notice, that in the cases where the destination shape is closed, two of the control points defining the spline segment, that connects the two shapes, are from the destination shape: LastPoint, and the control point prior to LastPoint. The third and last control point that defines the spline segment is FirstPoint of the source shape. Notice also, that when both the source and the destination shapes are closed the resulting shape is open (FirstPoint <> LastPoint).
The supplied transformation matrix transforms the source shape into the coordinate system of the destination shape. The two shapes do not become connected. Notice, that it is an error if both source and destination shape are open, since the resulting shape would otherwise not be connected. After the operation, only one of the following statements holds:
The latter statement only holds if the source shape is open and the destination shape is closed. The reason for this seemingly strange behavior is that the resulting shape can then be combined further in a consistent way. One can also think of this situation in terms of which shape is open after the operation  in this particular situation it is the source shape that is open.
In the examples below, FirstPoint of the source shape, LastPoint of the destination shape, and LastPoint of the resulting shape are marked with bullets.
Notice the last situation that is commented on above.
The Bifrost Graphics System  Reference Manual  © 19912004 Mjølner Informatics 
[Modified: Tuesday October 24^{th} 2000 at 15:02]
