diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 7086b20f7..488aeb75e 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -196,8 +196,10 @@ mod tests { half_edge }; let side_up = { - let mut side_up = PartialHalfEdge::default(); - side_up.replace_surface(surface.clone()); + let mut side_up = PartialHalfEdge { + surface: surface.clone(), + ..Default::default() + }; { let [back, front] = side_up @@ -217,8 +219,10 @@ mod tests { side_up }; let top = { - let mut top = PartialHalfEdge::default(); - top.replace_surface(surface.clone()); + let mut top = PartialHalfEdge { + surface: surface.clone(), + ..Default::default() + }; { let [(back, back_surface), (front, front_surface)] = @@ -243,8 +247,10 @@ mod tests { .clone() }; let side_down = { - let mut side_down = PartialHalfEdge::default(); - side_down.replace_surface(surface); + let mut side_down = PartialHalfEdge { + surface, + ..Default::default() + }; let [(back, back_surface), (front, front_surface)] = side_down.vertices.each_mut_ext(); diff --git a/crates/fj-kernel/src/builder/cycle.rs b/crates/fj-kernel/src/builder/cycle.rs index 158b057bb..3e7202905 100644 --- a/crates/fj-kernel/src/builder/cycle.rs +++ b/crates/fj-kernel/src/builder/cycle.rs @@ -149,7 +149,7 @@ impl CycleBuilder for PartialCycle { let [_, vertex] = &mut new_half_edge.vertices; vertex.1 = shared_surface_vertex; - new_half_edge.replace_surface(self.surface.clone()); + new_half_edge.surface = self.surface.clone(); new_half_edge.infer_global_form(); } diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index c500ab756..78f85e921 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -11,16 +11,6 @@ use super::CurveBuilder; /// Builder API for [`PartialHalfEdge`] pub trait HalfEdgeBuilder { - /// Completely replace the surface in this half-edge's object graph - /// - /// Please note that this operation will write to both vertices that the - /// half-edge references. If any of them were created from full objects, - /// this will break the connection to those, meaning that building the - /// partial objects won't result in those full objects again. This will be - /// the case, even if those full objects already referenced the provided - /// surface. - fn replace_surface(&mut self, surface: impl Into>); - /// Update partial half-edge to be a circle, from the given radius fn update_as_circle_from_radius(&mut self, radius: impl Into); @@ -61,12 +51,6 @@ pub trait HalfEdgeBuilder { } impl HalfEdgeBuilder for PartialHalfEdge { - fn replace_surface(&mut self, surface: impl Into>) { - let surface = surface.into(); - - self.surface = surface; - } - fn update_as_circle_from_radius(&mut self, radius: impl Into) { let path = self.curve.write().update_as_circle_from_radius(radius); @@ -130,7 +114,7 @@ impl HalfEdgeBuilder for PartialHalfEdge { surface: impl Into>, points: [impl Into>; 2], ) { - self.replace_surface(surface.into()); + self.surface = surface.into(); for (vertex, point) in self.vertices.each_mut_ext().zip_ext(points) { let mut surface_form = vertex.1.write(); diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 54c736008..a790d391c 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -30,8 +30,10 @@ impl Shape for fj::Sketch { let half_edge = { let surface = Partial::from(surface); - let mut half_edge = PartialHalfEdge::default(); - half_edge.replace_surface(surface); + let mut half_edge = PartialHalfEdge { + surface, + ..Default::default() + }; half_edge.update_as_circle_from_radius(circle.radius()); Partial::from_partial(half_edge)