use crate::{
path::SurfacePath,
stores::{Handle, HandleWrapper, Stores},
};
use super::Surface;
#[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
pub struct Curve {
path: SurfacePath,
surface: Handle<Surface>,
global_form: HandleWrapper<GlobalCurve>,
}
impl Curve {
pub fn new(
surface: Handle<Surface>,
path: SurfacePath,
global_form: impl Into<HandleWrapper<GlobalCurve>>,
stores: &Stores,
) -> Handle<Self> {
stores.curves.insert(Self {
surface,
path,
global_form: global_form.into(),
})
}
pub fn path(&self) -> SurfacePath {
self.path
}
pub fn surface(&self) -> &Handle<Surface> {
&self.surface
}
pub fn global_form(&self) -> &Handle<GlobalCurve> {
&self.global_form
}
}
#[derive(Clone, Copy, Debug)]
pub struct GlobalCurve;
impl GlobalCurve {
pub fn new(stores: &Stores) -> Handle<Self> {
stores.global_curves.insert(GlobalCurve)
}
}