Class GeoPointEnumerableExtension
- Namespace
- GeometryHelper.Extension
- Assembly
- GeometryHelper.dll
Provides extension methods over collections of 2D points.
public static class GeoPointEnumerableExtension
- Inheritance
-
GeoPointEnumerableExtension
- Inherited Members
Methods
- RemoveConsecutiveNearPoints(List<GeoPoint2>, Tolerance)
Thins a chain of points by dropping every point that lands within the tolerance of the point kept before it.
The comparison is against the last point kept, not against the original neighbour, and that is what makes the result hold its promise: no two consecutive points of the returned list are coincident within
tolerance. A huddle of points collapses onto the first of them, and collapsing stops as soon as one point escapes the tolerance around that anchor, so a run is never swallowed whole however long it is.The first point always survives; the last one is not privileged. A final point lying within the tolerance of the one kept before it is dropped like any other, which pulls the end of the chain back slightly. That matters when the points are about to become a polyline whose endpoint is meaningful.
Coincidence is measured by IsEqualTo(GeoPoint2, Tolerance), so it is EqualPoint that decides, and the same rule the polyline constructor applies when it filters its own vertices.
- RemoveConsecutiveNearPoints(List<GeoPoint3>, Tolerance)
Thins a chain of points by dropping every point that lands within the tolerance of the point kept before it.
The comparison is against the last point kept, not against the original neighbour, and that is what makes the result hold its promise: no two consecutive points of the returned list are coincident within
tolerance. A huddle of points collapses onto the first of them, and collapsing stops as soon as one point escapes the tolerance around that anchor, so a run is never swallowed whole however long it is.The first point always survives; the last one is not privileged. A final point lying within the tolerance of the one kept before it is dropped like any other, which pulls the end of the chain back slightly. That matters when the points are about to become a polyline whose endpoint is meaningful.
Coincidence is measured by IsEqualTo(GeoPoint3, Tolerance), so it is EqualPoint that decides, and the same rule the polyline constructor applies when it filters its own vertices.
- ToGeoLine2s(List<GeoPoint2>)
Builds the open chain of line segments running through the points, one segment per consecutive pair.
The chain is not closed: nothing joins the last point back to the first, so a ring has to repeat its first point at the end to come out closed. A list of n points yields n - 1 segments, and a list of fewer than two points yields none rather than failing.
Coincident neighbours are not filtered, so a repeated point produces a zero length segment. Run RemoveConsecutiveNearPoints(List<GeoPoint2>, Tolerance) first when that matters.
- ToGeoLine3s(List<GeoPoint3>)
Builds the open chain of line segments running through the points, one segment per consecutive pair.
The chain is not closed: nothing joins the last point back to the first, so a ring has to repeat its first point at the end to come out closed. A list of n points yields n - 1 segments, and a list of fewer than two points yields none rather than failing.
Coincident neighbours are not filtered, so a repeated point produces a zero length segment. Run RemoveConsecutiveNearPoints(List<GeoPoint3>, Tolerance) first when that matters.