Simplify polylines and polygons using the Ramer–Douglas–Peucker algorithm.
simplify(points, threshold, closed) ⇒
Return a simplified version of the polyline or polygon defined by the given points. Basically what happens is that some points are removed from the line, but only ones that leave the resulting line within a certain distance of the original.
Kind: Exported function
array - the simplified points. (This will always be separately
allocated object, not the one passed in, but it will contain the
same point objects passed in.)
||polyline or polygon. Each element of the array must be an object with at least x and y numeric properties. Neither the array nor any member will be modified.|
||maximum distance the simplified line can be from the original. Should be grater than or equal to zero. Passing zero means only colinear points will be eliminated; greater values lead to more aggressive line approximations.|
||if the passed first point and the last points are the same, this flag does nothing. Otherwise, if closed is true, the points will be treated as a polygon with an implied last segment between the last point and the first point.|