Table of Contents

Method IsSimple

Namespace
GeometryHelper.Core
Assembly
GeometryHelper.dll

IsSimple(GeoPolygon2)

Checks whether a polygon is simple, using default tolerance: no edge crosses or touches another except where neighbours share their vertex.

public static bool IsSimple(GeoPolygon2 polygon)

Parameters

polygon GeoPolygon2

The polygon.

Returns

bool

true if the polygon is simple; otherwise, false.

IsSimple(GeoPolygon2, Tolerance)

Checks whether a polygon is simple, within tolerance: no edge crosses or touches another except where neighbours share their vertex.

public static bool IsSimple(GeoPolygon2 polygon, Tolerance tolerance)

Parameters

polygon GeoPolygon2

The polygon.

tolerance Tolerance

The tolerance: edges closer than the point tolerance count as touching.

Returns

bool

true if the polygon is simple; otherwise, false.

Remarks

GeoPolygon2 does not check this when it is built, because the check costs more than building it. A polygon that is not simple is still read consistently, under the even-odd rule, but its area no longer means what it says. 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.

Exceptions

ArgumentNullException

Thrown when the polygon is null.