diff --git a/crates/fj-core/src/geometry/geometry.rs b/crates/fj-core/src/geometry/geometry.rs index 27e09c8d9..3c21b8554 100644 --- a/crates/fj-core/src/geometry/geometry.rs +++ b/crates/fj-core/src/geometry/geometry.rs @@ -11,7 +11,7 @@ use super::{GlobalPath, HalfEdgeGeometry, SurfaceGeometry}; /// Geometric data that is associated with topological objects pub struct Geometry { - half_edge: BTreeMap, HalfEdgeGeometry>, + half_edge: BTreeMap, HalfEdgeGeometry>, surface: BTreeMap, SurfaceGeometry>, xy_plane: Handle, @@ -61,7 +61,7 @@ impl Geometry { half_edge: Handle, geometry: HalfEdgeGeometry, ) { - self.half_edge.insert(half_edge, geometry); + self.half_edge.insert(half_edge.into(), geometry); } pub(crate) fn define_surface_inner( @@ -82,7 +82,7 @@ impl Geometry { half_edge: &Handle, ) -> HalfEdgeGeometry { self.half_edge - .get(half_edge) + .get(&half_edge.clone().into()) .copied() .expect("Expected geometry of half-edge to be defined") } diff --git a/crates/fj-core/src/objects/kinds/half_edge.rs b/crates/fj-core/src/objects/kinds/half_edge.rs index 24d9f4b18..e1bf01277 100644 --- a/crates/fj-core/src/objects/kinds/half_edge.rs +++ b/crates/fj-core/src/objects/kinds/half_edge.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - geometry::{CurveBoundary, SurfacePath}, + geometry::CurveBoundary, objects::{Curve, Vertex}, storage::{Handle, HandleWrapper}, }; @@ -35,7 +35,6 @@ use crate::{ /// [`Shell`]: crate::objects::Shell #[derive(Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct HalfEdge { - path: SurfacePath, boundary: CurveBoundary>, curve: HandleWrapper, start_vertex: HandleWrapper, @@ -44,24 +43,17 @@ pub struct HalfEdge { impl HalfEdge { /// Create an instance of `Edge` pub fn new( - path: SurfacePath, boundary: impl Into>>, curve: Handle, start_vertex: Handle, ) -> Self { Self { - path, boundary: boundary.into(), curve: curve.into(), start_vertex: start_vertex.into(), } } - /// Access the curve that defines the edge's geometry - pub fn path(&self) -> SurfacePath { - self.path - } - /// Access the boundary points of the edge on the curve pub fn boundary(&self) -> CurveBoundary> { self.boundary diff --git a/crates/fj-core/src/operations/build/half_edge.rs b/crates/fj-core/src/operations/build/half_edge.rs index 4c07637ea..a02e9a0a1 100644 --- a/crates/fj-core/src/operations/build/half_edge.rs +++ b/crates/fj-core/src/operations/build/half_edge.rs @@ -17,14 +17,13 @@ use crate::{ pub trait BuildHalfEdge { /// Create a half-edge that is not joined to a sibling fn unjoined( - path: SurfacePath, boundary: impl Into>>, core: &mut Core, ) -> HalfEdge { let curve = Curve::new().insert(core); let start_vertex = Vertex::new().insert(core); - HalfEdge::new(path, boundary, curve, start_vertex) + HalfEdge::new(boundary, curve, start_vertex) } /// Create a half-edge from its sibling @@ -34,7 +33,6 @@ pub trait BuildHalfEdge { core: &mut Core, ) -> Handle { let half_edge = HalfEdge::new( - core.layers.geometry.of_half_edge(sibling).path, sibling.boundary().reverse(), sibling.curve().clone(), start_vertex, @@ -74,7 +72,7 @@ pub trait BuildHalfEdge { let boundary = [arc.start_angle, arc.end_angle].map(|coord| Point::from([coord])); - let half_edge = HalfEdge::unjoined(path, boundary, core).insert(core); + let half_edge = HalfEdge::unjoined(boundary, core).insert(core); core.layers .geometry .define_half_edge(half_edge.clone(), HalfEdgeGeometry { path }); @@ -92,7 +90,7 @@ pub trait BuildHalfEdge { let boundary = [Scalar::ZERO, Scalar::TAU].map(|coord| Point::from([coord])); - let half_edge = HalfEdge::unjoined(path, boundary, core).insert(core); + let half_edge = HalfEdge::unjoined(boundary, core).insert(core); core.layers .geometry .define_half_edge(half_edge.clone(), HalfEdgeGeometry { path }); @@ -112,7 +110,7 @@ pub trait BuildHalfEdge { boundary.zip_ext(points_surface), ); - HalfEdge::unjoined(path, boundary, core) + HalfEdge::unjoined(boundary, core) .insert(core) .set_path(path, &mut core.layers.geometry) } diff --git a/crates/fj-core/src/operations/join/cycle.rs b/crates/fj-core/src/operations/join/cycle.rs index b58b1506d..c66ae593c 100644 --- a/crates/fj-core/src/operations/join/cycle.rs +++ b/crates/fj-core/src/operations/join/cycle.rs @@ -90,7 +90,7 @@ impl JoinCycle for Cycle { .into_iter() .circular_tuple_windows() .map(|((prev_half_edge, _, _), (half_edge, path, boundary))| { - HalfEdge::unjoined(path, boundary, core) + HalfEdge::unjoined(boundary, core) .update_curve(|_, _| half_edge.curve().clone(), core) .update_start_vertex( |_, _| prev_half_edge.start_vertex().clone(), diff --git a/crates/fj-core/src/operations/reverse/cycle.rs b/crates/fj-core/src/operations/reverse/cycle.rs index 36a6fa2ea..8ed73a81a 100644 --- a/crates/fj-core/src/operations/reverse/cycle.rs +++ b/crates/fj-core/src/operations/reverse/cycle.rs @@ -17,7 +17,6 @@ impl Reverse for Cycle { let path = core.layers.geometry.of_half_edge(current).path; HalfEdge::new( - path, current.boundary().reverse(), current.curve().clone(), next.start_vertex().clone(), diff --git a/crates/fj-core/src/operations/reverse/edge.rs b/crates/fj-core/src/operations/reverse/edge.rs index bba0b773a..65eecd191 100644 --- a/crates/fj-core/src/operations/reverse/edge.rs +++ b/crates/fj-core/src/operations/reverse/edge.rs @@ -14,7 +14,6 @@ impl ReverseCurveCoordinateSystems for Handle { let boundary = self.boundary().reverse(); let half_edge = HalfEdge::new( - path, boundary, self.curve().clone(), self.start_vertex().clone(), diff --git a/crates/fj-core/src/operations/split/half_edge.rs b/crates/fj-core/src/operations/split/half_edge.rs index efc170571..c899e3222 100644 --- a/crates/fj-core/src/operations/split/half_edge.rs +++ b/crates/fj-core/src/operations/split/half_edge.rs @@ -44,14 +44,12 @@ impl SplitHalfEdge for Handle { let [start, end] = self.boundary().inner; let a = HalfEdge::new( - core.layers.geometry.of_half_edge(self).path, [start, point], self.curve().clone(), self.start_vertex().clone(), ) .insert(core); let b = HalfEdge::new( - core.layers.geometry.of_half_edge(self).path, [point, end], self.curve().clone(), Vertex::new().insert(core), diff --git a/crates/fj-core/src/operations/transform/edge.rs b/crates/fj-core/src/operations/transform/edge.rs index 933ac520e..0ba22b374 100644 --- a/crates/fj-core/src/operations/transform/edge.rs +++ b/crates/fj-core/src/operations/transform/edge.rs @@ -28,7 +28,7 @@ impl TransformObject for Handle { .transform_with_cache(transform, core, cache); let half_edge = - HalfEdge::new(path, boundary, curve, start_vertex).insert(core); + HalfEdge::new(boundary, curve, start_vertex).insert(core); core.layers .geometry diff --git a/crates/fj-core/src/operations/update/half_edge.rs b/crates/fj-core/src/operations/update/half_edge.rs index f10ace4d6..003a6a224 100644 --- a/crates/fj-core/src/operations/update/half_edge.rs +++ b/crates/fj-core/src/operations/update/half_edge.rs @@ -38,7 +38,6 @@ impl UpdateHalfEdge for HalfEdge { T: Insert>, { HalfEdge::new( - self.path(), self.boundary(), update(self.curve(), core) .insert(core) @@ -56,7 +55,6 @@ impl UpdateHalfEdge for HalfEdge { T: Insert>, { HalfEdge::new( - self.path(), self.boundary(), self.curve().clone(), update(self.start_vertex(), core) diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 2f5597857..707f4be70 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -446,7 +446,6 @@ mod tests { cycle.half_edges().nth_circular(0), |half_edge, core| { [HalfEdge::new( - half_edge.path().reverse(), half_edge.boundary().reverse(), half_edge.curve().clone(), half_edge.start_vertex().clone(),