Method MakeValid
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
MakeValid(GeoPolygon2)
Gets the region a polygon covers as faces that do not cross themselves, using the default tolerance.
public static GeoFace2[] MakeValid(GeoPolygon2 polygon)
Parameters
polygonGeoPolygon2
Returns
- GeoFace2[]
MakeValid(GeoPolygon2, Tolerance)
Gets the region a polygon covers as faces that do not cross themselves, within a tolerance.
public static GeoFace2[] MakeValid(GeoPolygon2 polygon, Tolerance tolerance)
Parameters
polygonGeoPolygon2The polygon, which may cross itself.
toleranceToleranceThe tolerance.
Returns
- GeoFace2[]
The region the polygon covers, read as
Locateand the booleans read it — a point is inside when a ray from it crosses the outline an odd number of times — one face per piece; a simple polygon comes back as the one face it is.
Remarks
A polygon crossing itself is accepted as it is drawn, and its Area is the
shoelace sum, in which the lobes wound the other way count against the rest: a figure of eight with
lobes of 608 and 3 measures 605. The booleans and Locate read the region it covers instead, 611.
These faces are that region, so their areas add up to what the other questions see.
Exceptions
- ArgumentNullException
Thrown when the polygon is null.