mesh_graph/ops/add/vertex.rs
1use glam::Vec3;
2
3use crate::{MeshGraph, Vertex, VertexId};
4
5impl MeshGraph {
6 /// Inserts a vertex and it's position into the mesh graph.
7 /// It doesn't do any connections.
8 pub fn add_vertex(&mut self, position: Vec3) -> VertexId {
9 let vertex = Vertex::default();
10 let vertex_id = self.vertices.insert(vertex);
11 self.positions.insert(vertex_id, position);
12
13 self.outgoing_halfedges.insert(vertex_id, vec![]);
14
15 vertex_id
16 }
17}