mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-06 21:18:13 +08:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user