mod core;
mod lookup;
mod manipulators;
mod solvers;
mod structs;
mod transform;
use crate::consts::*;
use crate::utils;
pub use structs::*;
use glam::DVec2;
use std::fmt::{Debug, Formatter, Result};
#[derive(Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum BezierHandles {
Linear,
Quadratic {
handle: DVec2,
},
Cubic {
handle_start: DVec2,
handle_end: DVec2,
},
}
#[cfg(feature = "dyn-any")]
unsafe impl dyn_any::StaticType for BezierHandles {
type Static = BezierHandles;
}
#[derive(Copy, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Bezier {
pub start: DVec2,
pub end: DVec2,
pub handles: BezierHandles,
}
impl Debug for Bezier {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
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()
}
}
#[cfg(feature = "dyn-any")]
unsafe impl dyn_any::StaticType for Bezier {
type Static = Bezier;
}