diff --git a/crates/fj-core/src/operations/geometry/half_edge.rs b/crates/fj-core/src/operations/geometry/half_edge.rs index 04989a3a3..9897abc1b 100644 --- a/crates/fj-core/src/operations/geometry/half_edge.rs +++ b/crates/fj-core/src/operations/geometry/half_edge.rs @@ -1,2 +1,33 @@ +use crate::{ + geometry::SurfacePath, objects::HalfEdge, operations::insert::Insert, + storage::Handle, Core, +}; + /// Update the geometry of a [`HalfEdge`] -pub trait UpdateHalfEdgeGeometry {} +pub trait UpdateHalfEdgeGeometry { + /// Update the path of the edge + #[must_use] + fn update_path( + &self, + update: impl FnOnce(SurfacePath) -> SurfacePath, + core: &mut Core, + ) -> Self; +} + +impl UpdateHalfEdgeGeometry for Handle { + fn update_path( + &self, + update: impl FnOnce(SurfacePath) -> SurfacePath, + core: &mut Core, + ) -> Self { + let path = update(self.path()); + + HalfEdge::new( + path, + 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 c8992c629..3f41a89fb 100644 --- a/crates/fj-core/src/operations/update/half_edge.rs +++ b/crates/fj-core/src/operations/update/half_edge.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - geometry::{CurveBoundary, SurfacePath}, + geometry::CurveBoundary, objects::{Curve, HalfEdge, Vertex}, operations::{derive::DeriveFrom, insert::Insert}, storage::Handle, @@ -10,14 +10,6 @@ use crate::{ /// Update a [`HalfEdge`] pub trait UpdateHalfEdge: Sized { - /// Update the path of the edge - #[must_use] - fn update_path( - &self, - update: impl FnOnce(SurfacePath) -> SurfacePath, - core: &mut Core, - ) -> Handle; - /// Update the boundary of the edge #[must_use] fn update_boundary( @@ -47,22 +39,6 @@ pub trait UpdateHalfEdge: Sized { } impl UpdateHalfEdge for HalfEdge { - fn update_path( - &self, - update: impl FnOnce(SurfacePath) -> SurfacePath, - core: &mut Core, - ) -> Handle { - let path = update(self.path()); - - HalfEdge::new( - path, - self.boundary(), - self.curve().clone(), - self.start_vertex().clone(), - ) - .insert(core) - } - fn update_boundary( &self, update: impl FnOnce(CurveBoundary>) -> CurveBoundary>, diff --git a/crates/fj-core/src/validate/shell.rs b/crates/fj-core/src/validate/shell.rs index ff062f243..67c924c70 100644 --- a/crates/fj-core/src/validate/shell.rs +++ b/crates/fj-core/src/validate/shell.rs @@ -403,6 +403,7 @@ mod tests { objects::{Curve, Shell}, operations::{ build::BuildShell, + geometry::UpdateHalfEdgeGeometry, update::{ UpdateCycle, UpdateFace, UpdateHalfEdge, UpdateRegion, UpdateShell,