Next: , Previous: Swept points, Up: Sweeps



3.2.6.2 Swept lines

If swept_object is a polyline and there is no closure tag, then sweep connects n+1 successive copies of the polyline (including the original) with four-sided polygons, each pair of copies giving rise to a “polygon strip.” If there are m points in the original polyline, then (m-1)n polygons are formed by the sweep. We call these body polygons. In this manner, sweep forms a two-dimensional surface from from a one-dimensional polyline.

The order of vertices produced by sweep is important. If a polygon's vertices do not appear in counter-clockwise order in the final image, the polygon will be culled (unless cull=false is set). If the points in the k'th copy of the polyline are P_1, P_2, ..., P_m, and the points in the next copy, the (k+1)st, are P_1', P_2', ..., P_m', then the vertex order of the generated polygons is

     Body polygon 1: P_2 P_1 P_1' P_2'
     Body polygon 2: P_3 P_2 P_2' P_3'
     ...
     Body polygon m-1: P_m P_m-1 P_m-1' P_m'

Options of unclosed line sweeps are copied to each output polygon. Options of the swept line are ignored. When there is a closure tag, then sweep connects n successive copies of the polyline (including the original) with four-sided body polygons just as the case with no closure tag. It then connects the last copy back to the original to form a ribbon-shaped surface that closes on itself with two holes remaining.

Finally, the sweep adds two more polygons to seal the holes and form a closed surface that, depending on the sweep transforms, may represent the boundary of a solid. In this manner, sweep forms the boundary of a three-dimensional object from a one-dimensional polyline. We call these hole-filling polygons ends. The order of vertices of end polygons is important for correct culling as described above. If P_1^1, P_1^2, ..., P_1^n are the n copies of the first polyline point and P_m^1, P_m^2, ... ,P_m^n are the n copies of the last polyline point, then the end polygon vertex order is

     End polygon 1: P_1^n, P_1^n-1, ... ,P_1^1
     End polygon 2: P_m^1, P_m^2, ... ,P_m^n

If there are no options on the swept line, then the sweep options are copied to each output polygon. If the swept line does have options, these are copied to corresponding body polygons; the sweep options are copied to the end polygons. In this manner, body and ends may be drawn with different characteristics such as fillcolor.