Defined in:Triangulates a convex or concave polygon having nonzero genus.
int32 TriangulatePolygonalComplex(int32 windingCount, const int32 *vertexCount, const uint16 *const *vertexIndex,
const Point3D *vertex, const Vector3D& normal, Point3D *restrict result, Triangle16 *restrict triangle);
||The number of closed loops defining the shape of the polygonal complex. The first winding specifies the outside boundary of the positive polygon and should be wound counterclockwise. The remaining windings specify the boundaries of negative polygons representing holes that are cut out of the positive polygon and should be wound clockwise.|
||An array of vertex counts specifying the number of vertices in each winding.|
||An array of pointers to arrays containing the vertex indexes of the vertices used by each winding. For each winding, there is one pointer in this array that points to an array of indexes whose size is equal to the number of vertices belonging to the winding, as specified by the corresponding entry in the |
||An array containing all of the vertices belonging to all of the windings. The entries of the |
||The normal direction of the polygonal complex.|
||An array that receives the vertex positions in the final triangulation. This array should be large enough to hold the number of vertices equal to the sum of the values in the |
||An array to which the triangles are written. This must be large enough to hold n − 2 + 2g triangles, where n is the sum of the values in the |
TriangulatePolygonalComplexfunction takes an arbitrary planar polygon having any number of polygonal holes cut out of it, triangulates it, and returns the number of triangles that were generated. The polygonal complex is specified by one or more windings representing the boundary of the interior area. Except in cases in which there are degenerate vertices, the number of triangles generated will be n − 2 + 2g, where n is the sum of the values in the
vertexCountarray, and g is the genus of the complex, equal to one less than the value of the
Each of the windings may be convex or concave and may contain sets of collinear vertices. The first winding, whose vertices are specified by the first entries of the
vertexIndexarrays, represents the (positive) outer boundary of the complex. It should be wound counterclockwise about the normal direction specified by the
normalparameter. The remaining windings represent the boundaries of the (negative) holes that are cut out of the complex. These windings should be wound clockwise (so that the interior of the complex is always on the left-hand side when travelling along any winding). The negative windings must not intersect or enclose any other winding, and each must be completely contained within the positive winding. If these requirements are not met, then the results are undefined.
The results are undefined if any input winding is self-intersecting or if the vertices do not lie in a plane that is perpendicular to the normal direction specified by the
normalparameter. If any array of vertices contains degenerate entries (a pair of vertices that are very close to each other), then the result may be a subset of the fully triangulated polygonal complex, indicated by the return value being less than n − 2 + 2g.
The resulting triangles are returned in the array specified by the
triangleparameter. The input vertices are reordered and stored in the array specified by the
resultparameter. The indexes contained in the
trianglearray refer to vertices in the
windingCountparameter is 1 (the minimum value), then this function behaves exactly like the