Function simplify_rs::simplify_js
source · pub fn simplify_js(
points_js: &JsValue,
tolerance: f64,
auto_scale_for_precision: bool
) -> JsValue
Expand description
WASM function to simplify a path represented by a sequence of points to a bezier curve with a maximum error tolerance. The input points are expected to be in the format: [{x: 0, y: 0}, {x: 1, y: 1}, …]
-
tolerance
: the allowed maximum error when fitting the curves through the segment points -
`auto_scale_for_precision``: if true, the polygon will be scaled to a target area of TARGET_AUTO_SCALE_AREA before simplification and scaled back to the original scale after simplification. This increases the precision of the simplification.
§Returns
The output is a sequence of cubic bezier curves, each represented by 4 points: [{x: 0, y: 0}, {x: 1, y: 1}, {x: 2, y: 2}, {x: 3, y: 3}] [0] = start point [1] = control point 1 [2] = control point 2 [3] = end point