mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-27 13:58:12 +08:00
Implement self-intersection function for Beziers (#740)
* Initial commit and refactor reduce * Refactor reduce to get t values * Implement self intersection * Return pairs of t values * Fix results for the case where self is linear and other is not, address other comments * Update a rustdoc comment * Address final PR comments
This commit is contained in:
committed by
Keavon Chambers
parent
c00f520351
commit
a9b63f2a4c
@@ -174,6 +174,12 @@ impl WasmBezier {
|
||||
self.intersect(&cubic, Some(error))
|
||||
}
|
||||
|
||||
/// The wrapped return type is `Vec<[f64; 2]>`.
|
||||
pub fn intersect_self(&self, error: f64) -> JsValue {
|
||||
let points: Vec<[f64; 2]> = self.0.self_intersections(Some(error));
|
||||
to_js_value(points)
|
||||
}
|
||||
|
||||
pub fn reduce(&self) -> JsValue {
|
||||
let bezier_points: Vec<Vec<Point>> = self.0.reduce(None).into_iter().map(bezier_to_points).collect();
|
||||
to_js_value(bezier_points)
|
||||
|
||||
Reference in New Issue
Block a user