Skip to main content

geop_core_topology/model/
create.rs

1use crate::{
2    Coedge, CoedgeId, Edge, EdgeId, Face, FaceId, Shell, ShellId, Solid, SolidId, Vertex, VertexId,
3    Wire, WireId,
4};
5
6use super::Model;
7
8impl Model {
9    pub fn insert_vertex(&mut self, v: Vertex) -> VertexId {
10        let id = VertexId(self.fresh_id());
11        self.vertices.insert(id, v);
12        id
13    }
14
15    pub fn insert_edge(&mut self, e: Edge) -> EdgeId {
16        let id = EdgeId(self.fresh_id());
17        self.edges.insert(id, e);
18        id
19    }
20
21    pub fn insert_coedge(&mut self, c: Coedge) -> CoedgeId {
22        let id = CoedgeId(self.fresh_id());
23        self.coedges.insert(id, c);
24        id
25    }
26
27    pub fn insert_face(&mut self, f: Face) -> FaceId {
28        let id = FaceId(self.fresh_id());
29        self.faces.insert(id, f);
30        id
31    }
32
33    pub fn insert_shell(&mut self, s: Shell) -> ShellId {
34        let id = ShellId(self.fresh_id());
35        self.shells.insert(id, s);
36        id
37    }
38
39    pub fn insert_solid(&mut self, s: Solid) -> SolidId {
40        let id = SolidId(self.fresh_id());
41        self.solids.insert(id, s);
42        id
43    }
44
45    pub fn insert_wire(&mut self, w: Wire) -> WireId {
46        let id = WireId(self.fresh_id());
47        self.wires.insert(id, w);
48        id
49    }
50}