public void Tessellate(WindingRule windingRule, ElementType elementType, int polySize, CombineCallback combineCallback) { if (_vertices != null) { ArrayPool <ContourVertex> .Free(_vertices); ArrayPool <int> .Free(_elements); _vertices = null; _elements = null; } _windingRule = windingRule; _combineCallback = combineCallback; if (_mesh == null) { return; } // Determine the polygon normal and project vertices onto the plane // of the polygon. ProjectPolygon(); // ComputeInterior computes the planar arrangement specified // by the given contours, and further subdivides this arrangement // into regions. Each region is marked "inside" if it belongs // to the polygon, according to the rule given by windingRule. // Each interior region is guaranteed be monotone. ComputeInterior(); // If the user wants only the boundary contours, we throw away all edges // except those which separate the interior from the exterior. // Otherwise we tessellate all the regions marked "inside". if (elementType == ElementType.BoundaryContours) { SetWindingNumber(1, true); } else { TessellateInterior(); } _mesh.Check(); if (elementType == ElementType.BoundaryContours) { OutputContours(); } else { OutputPolymesh(elementType, polySize); } MeshUtils.Edge.FreeAll(); MeshUtils.Vertex.FreeAll(); ActiveRegion.FreeAll(); MeshUtils.Face.FreeAll(); ActiveRegionDict.Node.FreeAll(); _mesh = null; }