diff --git a/crates/fj-core/src/algorithms/transform/edge.rs b/crates/fj-core/src/algorithms/transform/edge.rs index f1b47c28a..b690751d1 100644 --- a/crates/fj-core/src/algorithms/transform/edge.rs +++ b/crates/fj-core/src/algorithms/transform/edge.rs @@ -18,6 +18,10 @@ impl TransformObject for HalfEdge { // coordinates. let path = self.path(); let boundary = self.boundary(); + let curve = self + .curve() + .clone() + .transform_with_cache(transform, services, cache); let start_vertex = self .start_vertex() .clone() @@ -27,7 +31,7 @@ impl TransformObject for HalfEdge { .clone() .transform_with_cache(transform, services, cache); - Self::new(path, boundary, start_vertex, global_form) + Self::new(path, boundary, curve, start_vertex, global_form) } } diff --git a/crates/fj-core/src/objects/kinds/edge.rs b/crates/fj-core/src/objects/kinds/edge.rs index 5154fd799..153f82ac2 100644 --- a/crates/fj-core/src/objects/kinds/edge.rs +++ b/crates/fj-core/src/objects/kinds/edge.rs @@ -2,7 +2,7 @@ use fj_math::Point; use crate::{ geometry::{BoundaryOnCurve, SurfacePath}, - objects::Vertex, + objects::{Curve, Vertex}, storage::{Handle, HandleWrapper}, }; @@ -42,6 +42,7 @@ use crate::{ pub struct HalfEdge { path: SurfacePath, boundary: BoundaryOnCurve, + curve: HandleWrapper, start_vertex: HandleWrapper, global_form: HandleWrapper, } @@ -51,12 +52,14 @@ impl HalfEdge { pub fn new( path: SurfacePath, boundary: impl Into, + curve: Handle, start_vertex: Handle, global_form: Handle, ) -> Self { Self { path, boundary: boundary.into(), + curve: curve.into(), start_vertex: start_vertex.into(), global_form: global_form.into(), } @@ -82,6 +85,11 @@ impl HalfEdge { self.path.point_from_path_coords(start) } + /// Access the curve of the half-edge + pub fn curve(&self) -> &Handle { + &self.curve + } + /// Access the vertex from where this half-edge starts pub fn start_vertex(&self) -> &Handle { &self.start_vertex diff --git a/crates/fj-core/src/operations/build/edge.rs b/crates/fj-core/src/operations/build/edge.rs index 6e850e549..3552ada11 100644 --- a/crates/fj-core/src/operations/build/edge.rs +++ b/crates/fj-core/src/operations/build/edge.rs @@ -3,7 +3,7 @@ use fj_math::{Arc, Point, Scalar}; use crate::{ geometry::{BoundaryOnCurve, SurfacePath}, - objects::{GlobalEdge, HalfEdge, Vertex}, + objects::{Curve, GlobalEdge, HalfEdge, Vertex}, operations::Insert, services::Services, }; @@ -16,10 +16,11 @@ pub trait BuildHalfEdge { boundary: impl Into, services: &mut Services, ) -> HalfEdge { + let curve = Curve::new().insert(services); let start_vertex = Vertex::new().insert(services); let global_form = GlobalEdge::new().insert(services); - HalfEdge::new(path, boundary, start_vertex, global_form) + HalfEdge::new(path, boundary, curve, start_vertex, global_form) } /// Create an arc diff --git a/crates/fj-core/src/operations/reverse/cycle.rs b/crates/fj-core/src/operations/reverse/cycle.rs index 62cac2ef1..7d2fdc3af 100644 --- a/crates/fj-core/src/operations/reverse/cycle.rs +++ b/crates/fj-core/src/operations/reverse/cycle.rs @@ -14,6 +14,7 @@ impl Reverse for Cycle { HalfEdge::new( current.path(), current.boundary().reverse(), + current.curve().clone(), next.start_vertex().clone(), current.global_form().clone(), ) diff --git a/crates/fj-core/src/operations/update/edge.rs b/crates/fj-core/src/operations/update/edge.rs index 91f400759..d065cee69 100644 --- a/crates/fj-core/src/operations/update/edge.rs +++ b/crates/fj-core/src/operations/update/edge.rs @@ -19,6 +19,7 @@ impl UpdateHalfEdge for HalfEdge { HalfEdge::new( self.path(), self.boundary(), + self.curve().clone(), start_vertex, self.global_form().clone(), ) @@ -28,6 +29,7 @@ impl UpdateHalfEdge for HalfEdge { HalfEdge::new( self.path(), self.boundary(), + self.curve().clone(), self.start_vertex().clone(), global_form, ) diff --git a/crates/fj-core/src/validate/edge.rs b/crates/fj-core/src/validate/edge.rs index 9516664b6..899a33b7b 100644 --- a/crates/fj-core/src/validate/edge.rs +++ b/crates/fj-core/src/validate/edge.rs @@ -95,6 +95,7 @@ mod tests { HalfEdge::new( valid.path(), boundary, + valid.curve().clone(), valid.start_vertex().clone(), valid.global_form().clone(), )