diff --git a/crates/fj-core/src/geometry/geometry.rs b/crates/fj-core/src/geometry/geometry.rs index 00cd56e77..c5869c40b 100644 --- a/crates/fj-core/src/geometry/geometry.rs +++ b/crates/fj-core/src/geometry/geometry.rs @@ -3,14 +3,15 @@ use std::collections::BTreeMap; use fj_math::Vector; use crate::{ - objects::{Objects, Surface}, + objects::{HalfEdge, Objects, Surface}, storage::{Handle, HandleWrapper}, }; -use super::{GlobalPath, SurfaceGeometry}; +use super::{GlobalPath, HalfEdgeGeometry, SurfaceGeometry}; /// Geometric data that is associated with topological objects pub struct Geometry { + half_edge: BTreeMap, HalfEdgeGeometry>, surface: BTreeMap, SurfaceGeometry>, xy_plane: Handle, @@ -22,6 +23,7 @@ impl Geometry { /// Create a new instance of `Geometry` pub fn new(objects: &Objects) -> Self { let mut self_ = Self { + half_edge: BTreeMap::new(), surface: BTreeMap::new(), xy_plane: objects.surfaces.xy_plane(), @@ -62,6 +64,21 @@ impl Geometry { self.surface.insert(surface.into(), geometry); } + /// # Access the geometry of the provided half-edge + /// + /// ## Panics + /// + /// Panics, if the geometry of the half-edge is not defined. + pub fn of_half_edge( + &self, + half_edge: &Handle, + ) -> HalfEdgeGeometry { + self.half_edge + .get(half_edge) + .copied() + .expect("Expected geometry of half-edge to be defined") + } + /// # Access the geometry of the provided surface /// /// ## Panics diff --git a/crates/fj-core/src/geometry/half_edge.rs b/crates/fj-core/src/geometry/half_edge.rs new file mode 100644 index 000000000..fc4c3a2e2 --- /dev/null +++ b/crates/fj-core/src/geometry/half_edge.rs @@ -0,0 +1,3 @@ +/// The geometry of a half-edge +#[derive(Copy, Clone)] +pub struct HalfEdgeGeometry {} diff --git a/crates/fj-core/src/geometry/mod.rs b/crates/fj-core/src/geometry/mod.rs index d5ee648a3..f387aff62 100644 --- a/crates/fj-core/src/geometry/mod.rs +++ b/crates/fj-core/src/geometry/mod.rs @@ -2,12 +2,14 @@ mod boundary; mod geometry; +mod half_edge; mod path; mod surface; pub use self::{ boundary::{CurveBoundary, CurveBoundaryElement}, geometry::Geometry, + half_edge::HalfEdgeGeometry, path::{GlobalPath, SurfacePath}, surface::SurfaceGeometry, };