Class ConvexHull2
- Namespace
- GeometryHelper.Core
- Assembly
- GeometryHelper.dll
The smallest convex polygon holding a set of points in the plane.
public static class ConvexHull2
- Inheritance
-
ConvexHull2
- Inherited Members
Remarks
Andrew's monotone chain: the points sorted along X, the lower and upper chains walked once each, a corner dropped whenever the chain would turn the wrong way or run straight on, judged exactly, so that no corner of the hull is ever lost to the tolerance. The tolerance then takes out the corners that do not matter: a corner within it of the segment between its neighbours, and one within it of the corner before. No point stands more than the tolerance outside the hull that is left, however many corners go. A set thinner than the tolerance may still get a hull, because the tolerance is spent corner by corner and may run out before the corners are gone; a set that lies within the tolerance of a segment, all of it, may have none. Points that differ in X by a trillionth and in Y by 15 still make their corner: a hull of (0, 0), (1E-12, -15.8), (2E-12, -6.25) and (20, 0) is a triangle of 158 square units.
Methods
- Of(IEnumerable<GeoPoint2>)
Gets the convex hull of some points, using the default tolerance.
- Of(IEnumerable<GeoPoint2>, Tolerance)
Gets the convex hull of some points, within a tolerance.
- TryOf(IEnumerable<GeoPoint2>, out GeoPolygon2)
Tries to get the convex hull of some points, using the default tolerance.
- TryOf(IEnumerable<GeoPoint2>, out GeoPolygon2, Tolerance)
Tries to get the convex hull of some points, within a tolerance.