1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use fj_math::Vector;
use crate::{
insert::Insert,
objects::{GlobalEdge, Objects, Vertex},
services::Service,
storage::Handle,
};
use super::{Sweep, SweepCache};
impl Sweep for Handle<Vertex> {
type Swept = (Handle<GlobalEdge>, [Self; 2]);
fn sweep_with_cache(
self,
_: impl Into<Vector<3>>,
cache: &mut SweepCache,
objects: &mut Service<Objects>,
) -> Self::Swept {
let a = self.clone();
let b = cache
.global_vertex
.entry(self.id())
.or_insert_with(|| Vertex::new().insert(objects))
.clone();
let vertices = [a, b];
let global_edge = GlobalEdge::new().insert(objects);
(global_edge, vertices)
}
}