Function simplify_rs::simplify
source · pub fn simplify(points: &[Point], tolerance: f64) -> Vec<Point>
Expand description
Fits a sequence of as few curves as possible through the path’s anchor points, ignoring the path items’s curve-handles, with an allowed maximum error. This method can be used to process and simplify the point data received from a mouse or touch device.
tolerance
: the allowed maximum error when fitting the curves through the segment points
§Returns
- returns the input if the input is less than 3 points
- x * 4 points (representing cubic bezier curves with duplicated start / end points) if the input is more than 3 points
NOTE: Depending on the tolerance, the endpoint of the input points and the endpoint of the simplified curve do not have to match up