A
tessellator object converts a simple
concave polygon (or a simple polygon with "holes") into a number of simple convex polygons (general triangles). A polygon is *
simple*
if it includes no duplicate vertices, if the edges intersect only at vertices, and exactly two edges meet at any vertex.

Each polygon can be marked as being either an interior or an exterior (default) polygon. Interior polygons are treated as holes in the exterior polygons. Multiple non-overlapping exterior polygons are allowed as well. All polygons should be specified in the same orientation (either clockwise or counter-clockwise). Once all the polygons have been passed into the tessellator object, the final triangulation is accomplished by the IDLgrTessellator::Tessellate method. A list of vertices and a connectivity array are returned. You may process these by hand, or pass them to an IDLgrPolygon object. The tessellator object will not create any vertices in the process, rather the output vertex list will include only those vertices passed into the object originally.

IDLgrTessellator::AddPolygon

The IDLgrTessellator::
AddPolygon procedure method adds a polygon to the tessellator object. **
IDLgrTessellator
**
is described above.

Set this keyword to an array of polygon descriptions. A polygon description is an integer or longword array of the form: [*
n*
, i_{
0}
, i_{
1}
, ..., i_{
n-1}
*
*
], where *
n*
is the number of vertices that define the polygon, and i_{
0}
..i*
n*
_{
-1}
*
*
are indices into the *
X*
, *
Y*
, and *
Z*
arguments that represent the polygon vertices. To ignore an entry in the POLYGON array, set the vertex count, *
n*
, to 0. To end the drawing list, even if additional array space is available, set *
n*
to -1. If this keyword is not specified, a single polygon will be generated.

IDLgrTessellator::Cleanup

The IDLgrTessellator::
Cleanup procedure method performs all cleanup on the object. **
IDLgrTessellator
**
is described above.

**NOTE: **
Cleanup methods are special *
lifecycle methods*
, and as such cannot be called outside the context of object destruction. This means that in most cases, you cannot call the Cleanup method directly. There is one exception to this rule: If you write your own subclass of this class, you can call the Cleanup method from within the Cleanup method of the subclass.

IDLgrTessellator::Init

The IDLgrTessellator::
Init function method initializes the tessellator object. **
IDLgrTessellator
**
is described above.

**NOTE: **
Init methods are special *
lifecycle methods*
, and as such cannot be called outside the context of object creation. This means that in most cases, you cannot call the Init method directly. There is one exception to this rule: If you write your own subclass of this class, you can call the Init method from within the Init method of the subclass.

Obj = OBJ_NEW('IDLgrTesselator')

Result = *
Obj*
```
->
```

*
[IDLgrTessellator::]*
Init(*
*
) (*
In a subclass' Init method only*
.)

IDLgrTessellator::Reset

The IDLgrTessellator::
Reset procedure method resets the object's internal state. All previously added polygons are removed from memory and the object is prepared for a new tessellation task. **
IDLgrTessellator
**
is described above.

IDLgrTessellator::Tessellate

The IDLgrTessellator::
Tessellate function method performs the actual tessellation. **
IDLgrTessellator
**
is described above.

If the tessellation succeeds, IDLgrTessellator::Tessellate returns 1 and the contents of Vertices and Poly are set to the results of the tessellation. If the tessellation fails, the function returns 0.

A 2*
x n*
array if all the input polygons were 2D. A 3*
x n*
array if all the input polygons were 3D.

An array of polygon descriptions. A polygon description is an integer or longword array of the form: [*
n*
, i_{
0}
, i_{
1}
, ..., i_{
n-1}
*
*
], where *
n*
is the number of vertices that define the polygon, and i_{
0}
..i*
n*
_{
-1}
*
*
are indices into the *
X*
, *
Y*
, and *
Z*
arguments that represent the polygon vertices.