use std::collections::BTreeMap;
use fj_math::Point;
use crate::{
objects::Vertex,
storage::{Handle, HandleWrapper},
};
#[derive(Default)]
pub struct VertexApproxCache {
inner: BTreeMap<HandleWrapper<Vertex>, Point<3>>,
}
impl VertexApproxCache {
pub fn get(&self, handle: &Handle<Vertex>) -> Option<Point<3>> {
self.inner.get(&handle.clone().into()).cloned()
}
pub fn insert(
&mut self,
handle: Handle<Vertex>,
position: Point<3>,
) -> Point<3> {
self.inner
.insert(handle.clone().into(), position)
.unwrap_or(position)
}
}