fj_core/algorithms/approx/
vertex.rs1use std::collections::BTreeMap;
4
5use fj_math::Point;
6
7use crate::{
8 objects::Vertex,
9 storage::{Handle, HandleWrapper},
10};
11
12#[derive(Default)]
14pub struct VertexApproxCache {
15 inner: BTreeMap<HandleWrapper<Vertex>, Point<3>>,
16}
17
18impl VertexApproxCache {
19 pub fn get(&self, handle: &Handle<Vertex>) -> Option<Point<3>> {
21 self.inner.get(&handle.clone().into()).cloned()
22 }
23
24 pub fn insert(
26 &mut self,
27 handle: Handle<Vertex>,
28 position: Point<3>,
29 ) -> Point<3> {
30 self.inner
31 .insert(handle.clone().into(), position)
32 .unwrap_or(position)
33 }
34}