Method IsSimple
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
IsSimple(GeoPolygon3)
Checks whether a polygon is simple, using the default tolerance: no edge crosses or touches another except where neighbours share their vertex.
public static bool IsSimple(GeoPolygon3 polygon)
Parameters
polygonGeoPolygon3
Returns
IsSimple(GeoPolygon3, Tolerance)
Checks whether a polygon is simple, within a tolerance: no edge crosses or touches another except where neighbours share their vertex.
public static bool IsSimple(GeoPolygon3 polygon, Tolerance tolerance)
Parameters
polygonGeoPolygon3The polygon.
toleranceToleranceThe tolerance: edges closer than the point tolerance count as touching.
Returns
- bool
true if the polygon is simple; otherwise, false.
Remarks
GeoPolygon3 checks that it is flat but not that it is simple, because the check costs more than building it. A vertex touching another edge counts as not simple, and so does an edge folding back over its neighbour. Edges are swept in order along X, so the cost grows with the number of edges whose extents overlap rather than with the square of the edge count. Where they overlap much along X, the sweep runs along whichever of X, Y and Z leaves the fewest pairs instead, with the same answer: a comb of 1 000 teeth 10 000 long laid along X, 4 000 edges, checked as it is and with a corner pushed in to touch the next tooth, took 35 ms swept along its teeth and takes 2.8 ms swept across them.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.