public class RamerDouglasPeucker extends Object
PolygonalChain
by removing vertices
which do not affect the shape of the curve to a given tolerance.
The algorithm works by finding the point which is farthest from the line segment defined by the
endpoints. If the distance is within a specified tolerance, all vertices are removed but the
endpoints. Otherwise, the list of line segments is divided into two parts: from the first point
to the farthest point, and from the farthest point to the last point, then the algorithm
recursively calls itself with these two parts (and the farthest point is kept).Constructor and Description |
---|
RamerDouglasPeucker(double threshold)
Create an algorithm instance with a given threshold for the maximum distance between the
original chain and a point in the simplified chain.
|
Modifier and Type | Method and Description |
---|---|
PolygonalChain |
simplify(PolygonalChain chain)
Simplify the given polygonal chain.
|
public RamerDouglasPeucker(double threshold)
threshold
- the threshold (non-negative)public PolygonalChain simplify(PolygonalChain chain)
chain
- the original polygonal curveCopyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.