Method RemoveConsecutiveNearPoints
- Namespace
- GeometryHelper.Extension
- Assembly
- GeometryHelper.dll
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.
public static List<GeoPoint2> RemoveConsecutiveNearPoints(this List<GeoPoint2> points, Tolerance tolerance)
Parameters
pointsList<GeoPoint2>The points to thin, in order.
toleranceToleranceThe tolerance whose EqualPoint decides coincidence.
Returns
- List<GeoPoint2>
A new list holding the surviving points in their original order. The input is left untouched, and a list of one point or none comes back as a copy.
Exceptions
- ArgumentNullException
Thrown when
pointsis null.
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.
public static List<GeoPoint3> RemoveConsecutiveNearPoints(this List<GeoPoint3> points, Tolerance tolerance)
Parameters
pointsList<GeoPoint3>The points to thin, in order.
toleranceToleranceThe tolerance whose EqualPoint decides coincidence.
Returns
- List<GeoPoint3>
A new list holding the surviving points in their original order. The input is left untouched, and a list of one point or none comes back as a copy.
Exceptions
- ArgumentNullException
Thrown when
pointsis null.