Table of Contents

Method ProjectToPolygon

Namespace
GeometryHelper.Core
Assembly
GeometryHelper.dll

ProjectToPolygon(GeoPolygon2, GeoPoint2)

Projects a point onto the boundary of a polygon using default tolerance.

public static GeoPoint2 ProjectToPolygon(GeoPolygon2 poly, GeoPoint2 point)

Parameters

poly GeoPolygon2

The polygon.

point GeoPoint2

The target point.

Returns

GeoPoint2

The closest point on the polygon boundary.

ProjectToPolygon(GeoPolygon2, GeoPoint2, Tolerance)

Projects a point onto the boundary of a polygon within tolerance (finds the closest point on any edge). The result always lies on the boundary, including for points inside the polygon.

public static GeoPoint2 ProjectToPolygon(GeoPolygon2 poly, GeoPoint2 point, Tolerance tolerance)

Parameters

poly GeoPolygon2

The polygon.

point GeoPoint2

The target point.

tolerance Tolerance

The tolerance; every side is measured as it is, so it changes nothing here.

Returns

GeoPoint2

The closest point on the polygon boundary.

Remarks

A side offers its nearest point as the side it is however short, as the distance measures it, where a segment no longer than the tolerance on its own is read as its start: at a hundredth, the polygon (0, 0), (10, 0), (10, 0.006), (0, 10) is 0.03 from (10.03, 0.003), and the closest point is (10, 0.003), 0.03 away, where its side 0.006 long, no longer than the tolerance, offered its start (10, 0), 0.0301496 away.