Bezier-rs: Add trim for Subpath (#1006)

* Move compare.rs

* Update traits for Subpath and ManipulatorGroup

* Implement trim

* UI adjustments and more tests

* Add reverse, refactor code, rename variables

* Improve comments

* Comment nits

* Address comments

* Update trim behavior

* Update doc comment for trim

---------

Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
Hannah Li
2023-02-26 18:41:11 -05:00
committed by Keavon Chambers
co-authored by Keavon Chambers
parent 4495488546
commit 8d3daeae78
13 changed files with 571 additions and 64 deletions
+8 -4
View File
@@ -1,6 +1,3 @@
#[cfg(test)]
pub(super) mod compare;
mod core;
mod lookup;
mod manipulators;
@@ -47,6 +44,13 @@ pub struct Bezier {
impl Debug for Bezier {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
write!(f, "{:?}", self.get_points().collect::<Vec<DVec2>>())
let mut debug_struct = f.debug_struct("Bezier");
let mut debug_struct_ref = debug_struct.field("start", &self.start);
debug_struct_ref = match self.handles {
BezierHandles::Linear => debug_struct_ref,
BezierHandles::Quadratic { handle } => debug_struct_ref.field("handle", &handle),
BezierHandles::Cubic { handle_start, handle_end } => debug_struct_ref.field("handle_start", &handle_start).field("handle_end", &handle_end),
};
debug_struct_ref.field("end", &self.end).finish()
}
}