Primitives are only contained in objects. The following primitives are supported in SilverScreen. Each of these primitive types has a structure definition. The names of these structures are:
All primitives are directly or indirectly contained in objects. However, primitives may be contained within other primitives. A polyline, for example, consists of a set of lines; a Bezier curve consists of a set of Bezier points.
The following summarizes the rules of association for primitives:
An arc may be an independent primitive.
An arc may be contained in a polyline or polygon.
A circle/ellipse is an independent primitive.
A line may be an independent primitive.
A line may be contained in a polyline or polygon.
A polygon consists of lines and arcs.
A polyline consists of lines and arcs.
A point is an independent primitive.
A spline curve consists of a set of control points.
A Bezier curve consists of a set of control points.
Holes give a second level of association for certain primitives. Here are the rules of association for holes:
A circle/ellipse may contain one or more holes.
A polygon may contain one or more holes.
A closed spline curve may contain one or more holes.
A closed Bezier curve may contain one or more holes.
A circle/ellipse may be a hole.
A polygon may be a hole.
A closed spline curve may be a hole.
A closed Bezier curve may be a hole.
No other primitive may be a hole.
Another level of associativity is the phantom. Phantoms give additional information about a primitive.
To understand the use of the phantom, consider the following: A rectangle is drawn and filleted on all four corners. This results in a polygon that consists of four lines and four arcs. This polygon is then swept linearly to produce a solid. Since the SilverScreen solid consists of polygons that contain only lines, the arc information would seemingly be lost in producing the solid.
However, to retain this arc information, a new association is formed. This association relates the polygon to the arcs that, prior to the sweep, were part of the polygon. Arcs (and circles) of this type are called phantoms. Phantoms, while not visible on the screen, may be used for dimensioning or for export to CAM.
Here are the rules of association for phantoms:
A phantom may be either a circle/ellipse or an arc.
A phantom may be contained in either a polygon or a polyline.
A phantom may not contain holes.
All primitive structures have a common prefix consisting of 5 fields. This common structure is PRIM_NODE, a structure which is shown below.
This structure contains:
The following shows the definitions that are used to identify the various node types:
The following illustrates a traversal of the primitives that linked directly to an object node:
The above function only identifies three primitive types. The remaining types are lumped together as "Other type".
The structure of the polygon node is displayed below:
The following function will list the lines that are contained in polygons that are directly within the object. This function uses a first_node pointer in the POLYGON_NODE to locate the first primitive in a list of primitives within the polygon. These primitives (within the polygon) are linked via the next_node pointer and terminate with a null pointer.