About Polygon and Polyline Objects
Polygon and Polyline objects are both defined by set of vertices that share rendering attributes. This section introduces how to create and configure polygon and polyline objects.
Creating Polygon and Polyline Objects
You can define the shape of a polygon or polyline object by either setting vertex data directly (by passing a 2-by-n or a 3-by-n array to the DATA property), or by passing a descriptive array to the IDLgrPolygon POLYGONS property or the IDLgrPolyline POLYLINES property. This section describes the later method, which uses a connectivity array to define the shape of an IDLgrPolygon or IDLgrPolyline object.
Note
The following description of the connectivity array applies to polygons and polylines with the exception that for a polyline mesh, vertex data includes color, but not normals or texture coordinates.
A polygon description is a numeric list of the form: [n, i0, i1, ..., in-1], where n is the number of vertices that define the polygon, and i0..in-1 are indices into a polygon vertex list. For example, the list [5, 0, 1, 2, 3, 4] describes a polygon with 5 vertices comprised of the first 5 vertices in the vertex list.
The polygon description list, also known as a connectivity array, allows an individual object to contain more than one polygon. The polygons can be independent and distinct, sharing no vertices amongst the polygons. Alternatively, the connectivity array can describe a mesh, where vertices are shared by a number of polygons, usually triangles or quads, in the mesh. In the case of a mesh, the vertex information, including normals, colors, and texture coordinates, is also shared by the polygons composing the mesh. See Polygon Mesh Optimization for more information.
A polygon description list may contain "skipped" polygon descriptions by replacing a description with zeroes. This may be more convenient than building a new array. For example, if we have a polygon description list containing three triangles:
we can skip drawing the middle triangle by setting the array to:
The same effect can be achieved by:
A polygon description list can also be terminated early by putting a -1 in the array in the position after the last polygon to be drawn.
The -1 at index 8 effectively makes this a list of two polygon descriptions. Entries after the -1 are ignored.
See Polygon Objects and Polyline Objects for more information about configuring these object.