Expand description
An implementation of the Ramer-Douglas-Peucker algorithm for curve simplification.
The algorithm reduces the number of points in a curve while preserving its shape.
Points that deviate less than epsilon from the simplified line are removed.
§Example
use mint::Point2;
use ramer_douglas_peucker::rdp;
let points = vec![
Point2 { x: 0.0, y: 0.0 },
Point2 { x: 1.0, y: 0.5 },
Point2 { x: 2.0, y: -0.9 },
Point2 { x: 3.0, y: 0.3 },
Point2 { x: 4.0, y: 0.0 },
];
let indices = rdp(&points, 1.0);
assert_eq!(indices, vec![0, 4]);Functions§
- rdp
- Simplifies a curve using the Ramer-Douglas-Peucker algorithm.