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 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<Handle<HalfEdge>, HalfEdgeGeometry>,
surface: BTreeMap<HandleWrapper<Surface>, SurfaceGeometry>,
xy_plane: Handle<Surface>,
@ -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<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
///
/// ## 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 geometry;
mod half_edge;
mod path;
mod surface;
pub use self::{
boundary::{CurveBoundary, CurveBoundaryElement},
geometry::Geometry,
half_edge::HalfEdgeGeometry,
path::{GlobalPath, SurfacePath},
surface::SurfaceGeometry,
};