Add HalfEdgeGeometry

At this point, it is only an empty placeholder.
This commit is contained in:
Hanno Braun 2024-03-14 12:51:11 +01:00
parent 795fe382a0
commit 987ddd7e50
3 changed files with 24 additions and 2 deletions

View File

@ -3,14 +3,15 @@ use std::collections::BTreeMap;
use fj_math::Vector; use fj_math::Vector;
use crate::{ use crate::{
objects::{Objects, Surface}, objects::{HalfEdge, Objects, Surface},
storage::{Handle, HandleWrapper}, storage::{Handle, HandleWrapper},
}; };
use super::{GlobalPath, SurfaceGeometry}; use super::{GlobalPath, HalfEdgeGeometry, SurfaceGeometry};
/// Geometric data that is associated with topological objects /// Geometric data that is associated with topological objects
pub struct Geometry { pub struct Geometry {
half_edge: BTreeMap<Handle<HalfEdge>, HalfEdgeGeometry>,
surface: BTreeMap<HandleWrapper<Surface>, SurfaceGeometry>, surface: BTreeMap<HandleWrapper<Surface>, SurfaceGeometry>,
xy_plane: Handle<Surface>, xy_plane: Handle<Surface>,
@ -22,6 +23,7 @@ impl Geometry {
/// Create a new instance of `Geometry` /// Create a new instance of `Geometry`
pub fn new(objects: &Objects) -> Self { pub fn new(objects: &Objects) -> Self {
let mut self_ = Self { let mut self_ = Self {
half_edge: BTreeMap::new(),
surface: BTreeMap::new(), surface: BTreeMap::new(),
xy_plane: objects.surfaces.xy_plane(), xy_plane: objects.surfaces.xy_plane(),
@ -62,6 +64,21 @@ impl Geometry {
self.surface.insert(surface.into(), 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<HalfEdge>,
) -> HalfEdgeGeometry {
self.half_edge
.get(half_edge)
.copied()
.expect("Expected geometry of half-edge to be defined")
}
/// # Access the geometry of the provided surface /// # Access the geometry of the provided surface
/// ///
/// ## Panics /// ## Panics

View File

@ -0,0 +1,3 @@
/// The geometry of a half-edge
#[derive(Copy, Clone)]
pub struct HalfEdgeGeometry {}

View File

@ -2,12 +2,14 @@
mod boundary; mod boundary;
mod geometry; mod geometry;
mod half_edge;
mod path; mod path;
mod surface; mod surface;
pub use self::{ pub use self::{
boundary::{CurveBoundary, CurveBoundaryElement}, boundary::{CurveBoundary, CurveBoundaryElement},
geometry::Geometry, geometry::Geometry,
half_edge::HalfEdgeGeometry,
path::{GlobalPath, SurfacePath}, path::{GlobalPath, SurfacePath},
surface::SurfaceGeometry, surface::SurfaceGeometry,
}; };