Class RamerDouglasPeucker


  • public class RamerDouglasPeucker
    extends Object
    The Ramer-Douglas-Peucker algorithm simplifies a 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).

    See Also:
    Wikipedia: Ramer-Douglas-Peucker algorithm
    • Constructor Detail

      • RamerDouglasPeucker

        public 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.
        Parameters:
        threshold - the threshold (non-negative)
    • Method Detail

      • simplify

        public PolygonalChain simplify​(PolygonalChain chain)
        Simplify the given polygonal chain.
        Parameters:
        chain - the original polygonal curve
        Returns:
        the simplified curve