diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 2018259de..a4c09f01e 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -219,7 +219,7 @@ mod tests { ) .build(&objects)?; let side_up = HalfEdge::partial() - .with_surface(Some(surface.clone())) + .with_surface(surface.clone()) .with_back_vertex(Vertex::partial().with_surface_form( bottom.front().surface_form().clone(), )) @@ -229,7 +229,7 @@ mod tests { .update_as_line_segment() .build(&objects)?; let top = HalfEdge::partial() - .with_surface(Some(surface.clone())) + .with_surface(surface.clone()) .with_back_vertex(Vertex::partial().with_surface_form( SurfaceVertex::partial().with_position(Some([0., 1.])), )) @@ -241,7 +241,7 @@ mod tests { .reverse(&objects)?; let side_down = HalfEdge::partial() - .with_surface(Some(surface)) + .with_surface(surface) .with_back_vertex(Vertex::partial().with_surface_form( bottom.back().surface_form().clone(), )) diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index c47ce959c..e3ab4d1d0 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -97,7 +97,7 @@ impl HalfEdgeBuilder for PartialHalfEdge { Vertex::partial().with_surface_form(surface_form) }); - self.with_surface(Some(surface)) + self.with_surface(surface) .with_vertices(Some(vertices)) .update_as_line_segment() } diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 578831c23..bc8479abf 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -58,7 +58,7 @@ impl PartialCycle { if let Some(surface) = surface { for half_edge in &mut self.half_edges { *half_edge = half_edge.clone().update_partial(|half_edge| { - half_edge.with_surface(Some(surface.clone())) + half_edge.with_surface(surface.clone()) }); } } diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index a3a5459ad..e9704695f 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -47,24 +47,22 @@ impl PartialHalfEdge { } /// Update the partial half-edge with the given surface - pub fn with_surface(mut self, surface: Option>) -> Self { - if let Some(surface) = surface { - self.curve = self.curve.update_partial(|curve| { - curve.with_surface(Some(surface.clone())) - }); + pub fn with_surface(mut self, surface: Handle) -> Self { + self.curve = self + .curve + .update_partial(|curve| curve.with_surface(Some(surface.clone()))); - self.vertices = self.vertices.map(|vertex| { - vertex.update_partial(|vertex| { - let surface_form = vertex.surface_form().update_partial( - |surface_vertex| { - surface_vertex.with_surface(Some(surface.clone())) - }, - ); + self.vertices = self.vertices.map(|vertex| { + vertex.update_partial(|vertex| { + let surface_form = + vertex.surface_form().update_partial(|surface_vertex| { + surface_vertex.with_surface(Some(surface.clone())) + }); + + vertex.with_surface_form(surface_form) + }) + }); - vertex.with_surface_form(surface_form) - }) - }); - } self } diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 0250d1184..8e838ec2b 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -28,7 +28,7 @@ impl Shape for fj::Sketch { // none need to be added here. let half_edge = HalfEdge::partial() - .with_surface(Some(surface)) + .with_surface(surface) .update_as_circle_from_radius(circle.radius(), objects)? .build(objects)?; let cycle = objects.cycles.insert(Cycle::new([half_edge]))?;