Table of Contents

Class PolygonRegion

Namespace
CADability
Assembly
CADability.dll

Turns a set of closed polygons that may intersect themselves and each other into non intersecting outline/hole groups, which is what a constrained (Delaunay) triangulation needs. The input follows the usual convention: counterclockwise loops are outlines, clockwise loops are holes; the region described by the input is the set of points with a winding number of 1 or more.

Such polygons appear when the outline of a Face is approximated by polylines: two curves that touch tangentially (or a hole that comes very close to the outline) are approximated with different points, so their polygons cross each other even though the curves do not. The crossings are small and unavoidable, but they make the input invalid for a constrained triangulation.

The implementation computes the planar arrangement of all segments: all segments are split at their mutual intersections, the resulting graph is traversed face by face and each face gets its winding number. The boundary of the faces with a winding number of 1 or more is the result. Everything is done with line segments only, no Border, SimpleShape or CompoundShape is involved.

public class PolygonRegion
Inheritance
PolygonRegion
Inherited Members

Methods

Subdivide(GeoPoint2D[][], double)

Splits loops (first loop: counterclockwise outline, following loops: clockwise holes) into groups of non intersecting loops. Each group of the result starts with a counterclockwise outline, followed by the clockwise holes of that outline. Loops with an area of less than minArea are omitted.

public static GeoPoint2D[][][] Subdivide(GeoPoint2D[][] loops, double minArea)

Parameters

loops GeoPoint2D[][]
minArea double

Returns

GeoPoint2D[][][]