From d60bfc1d91c3f46d2c54e756b7646925cd790f76 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 1 Aug 2023 11:48:45 +0200 Subject: [PATCH 1/2] Add `UpdateHalfEdge::replace_boundary` --- crates/fj-core/src/operations/update/edge.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index b67dfee78..9d3184a6c 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -1,10 +1,17 @@ +use fj_math::Point; + use crate::{ + geometry::CurveBoundary, objects::{Curve, GlobalEdge, HalfEdge, Vertex}, storage::Handle, }; /// Update a [`HalfEdge`] pub trait UpdateHalfEdge { + /// Replace the boundary of the half-edge + #[must_use] + fn replace_boundary(&self, boundary: CurveBoundary>) -> Self; + /// Replace the curve of the half-edge #[must_use] fn replace_curve(&self, curve: Handle) -> Self; @@ -19,6 +26,16 @@ pub trait UpdateHalfEdge { } impl UpdateHalfEdge for HalfEdge { + fn replace_boundary(&self, boundary: CurveBoundary>) -> Self { + HalfEdge::new( + self.path(), + boundary, + self.curve().clone(), + self.start_vertex().clone(), + self.global_form().clone(), + ) + } + fn replace_curve(&self, curve: Handle) -> Self { HalfEdge::new( self.path(), From ef9993e0f0162344db8eb80e70f6f291b1fa9f18 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 1 Aug 2023 11:51:58 +0200 Subject: [PATCH 2/2] Add `UpdateHalfEdge::replace_path` --- crates/fj-core/src/operations/update/edge.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index 9d3184a6c..3a415897d 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -1,13 +1,17 @@ use fj_math::Point; use crate::{ - geometry::CurveBoundary, + geometry::{CurveBoundary, SurfacePath}, objects::{Curve, GlobalEdge, HalfEdge, Vertex}, storage::Handle, }; /// Update a [`HalfEdge`] pub trait UpdateHalfEdge { + /// Replace the path of the half-edge + #[must_use] + fn replace_path(&self, path: SurfacePath) -> Self; + /// Replace the boundary of the half-edge #[must_use] fn replace_boundary(&self, boundary: CurveBoundary>) -> Self; @@ -26,6 +30,16 @@ pub trait UpdateHalfEdge { } impl UpdateHalfEdge for HalfEdge { + fn replace_path(&self, path: SurfacePath) -> Self { + HalfEdge::new( + path, + self.boundary(), + self.curve().clone(), + self.start_vertex().clone(), + self.global_form().clone(), + ) + } + fn replace_boundary(&self, boundary: CurveBoundary>) -> Self { HalfEdge::new( self.path(),