diff --git a/crates/fj-core/src/operations/geometry/half_edge.rs b/crates/fj-core/src/operations/geometry/half_edge.rs index 9897abc1b..54de2f73f 100644 --- a/crates/fj-core/src/operations/geometry/half_edge.rs +++ b/crates/fj-core/src/operations/geometry/half_edge.rs @@ -1,6 +1,11 @@ +use fj_math::Point; + use crate::{ - geometry::SurfacePath, objects::HalfEdge, operations::insert::Insert, - storage::Handle, Core, + geometry::{CurveBoundary, SurfacePath}, + objects::HalfEdge, + operations::insert::Insert, + storage::Handle, + Core, }; /// Update the geometry of a [`HalfEdge`] @@ -12,6 +17,14 @@ pub trait UpdateHalfEdgeGeometry { update: impl FnOnce(SurfacePath) -> SurfacePath, core: &mut Core, ) -> Self; + + /// Update the boundary of the edge + #[must_use] + fn update_boundary( + &self, + update: impl FnOnce(CurveBoundary>) -> CurveBoundary>, + core: &mut Core, + ) -> Self; } impl UpdateHalfEdgeGeometry for Handle { @@ -30,4 +43,18 @@ impl UpdateHalfEdgeGeometry for Handle { ) .insert(core) } + + fn update_boundary( + &self, + update: impl FnOnce(CurveBoundary>) -> CurveBoundary>, + core: &mut Core, + ) -> Self { + HalfEdge::new( + self.path(), + update(self.boundary()), + self.curve().clone(), + self.start_vertex().clone(), + ) + .insert(core) + } } diff --git a/crates/fj-core/src/operations/update/half_edge.rs b/crates/fj-core/src/operations/update/half_edge.rs index 697d74fed..f10ace4d6 100644 --- a/crates/fj-core/src/operations/update/half_edge.rs +++ b/crates/fj-core/src/operations/update/half_edge.rs @@ -1,7 +1,4 @@ -use fj_math::Point; - use crate::{ - geometry::CurveBoundary, objects::{Curve, HalfEdge, Vertex}, operations::{derive::DeriveFrom, insert::Insert}, storage::Handle, @@ -10,13 +7,6 @@ use crate::{ /// Update a [`HalfEdge`] pub trait UpdateHalfEdge { - /// Update the boundary of the edge - #[must_use] - fn update_boundary( - &self, - update: impl FnOnce(CurveBoundary>) -> CurveBoundary>, - ) -> Self; - /// Update the curve of the edge #[must_use] fn update_curve( @@ -39,18 +29,6 @@ pub trait UpdateHalfEdge { } impl UpdateHalfEdge for HalfEdge { - fn update_boundary( - &self, - update: impl FnOnce(CurveBoundary>) -> CurveBoundary>, - ) -> Self { - HalfEdge::new( - self.path(), - update(self.boundary()), - self.curve().clone(), - self.start_vertex().clone(), - ) - } - fn update_curve( &self, update: impl FnOnce(&Handle, &mut Core) -> T, diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index 67c924c70..48bf7a8cb 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -436,9 +436,10 @@ mod tests { |path| path.reverse(), core, ) - .update_boundary(|boundary| { - boundary.reverse() - })] + .update_boundary( + |boundary| boundary.reverse(), + core, + )] }, core, )