Bézier-rs: Add utils to subpath (#1058)

* Add utils to bezier-rs subpath

* Apply code review changes

* Remove tan from constant

* Fix compile

* Fix tests
This commit is contained in:
0HyperCube
2023-03-02 16:48:09 +00:00
committed by GitHub
parent 9dcabc053b
commit 0fb2c4d06c
12 changed files with 206 additions and 10 deletions
+12
View File
@@ -15,6 +15,7 @@ use std::fmt::{Debug, Formatter, Result};
/// Representation of the handle point(s) in a bezier segment.
#[derive(Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
enum BezierHandles {
Linear,
/// Handles for a quadratic curve.
@@ -31,8 +32,14 @@ enum BezierHandles {
},
}
#[cfg(feature = "dyn-any")]
impl dyn_any::StaticType for BezierHandles {
type Static = BezierHandles;
}
/// Representation of a bezier curve with 2D points.
#[derive(Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Bezier {
/// Start point of the bezier curve.
start: DVec2,
@@ -54,3 +61,8 @@ impl Debug for Bezier {
debug_struct_ref.field("end", &self.end).finish()
}
}
#[cfg(feature = "dyn-any")]
impl dyn_any::StaticType for Bezier {
type Static = Bezier;
}