From 74a9fa546b5eec1be19a1a2352c88b5a8694ab39 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 12 Oct 2022 15:00:17 +0200 Subject: [PATCH] Fix `SurfaceVertex` duplication in `Vertex` sweep --- .../fj-kernel/src/algorithms/sweep/vertex.rs | 40 ++++++++----------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/vertex.rs b/crates/fj-kernel/src/algorithms/sweep/vertex.rs index 4238bd58a..8d96aa216 100644 --- a/crates/fj-kernel/src/algorithms/sweep/vertex.rs +++ b/crates/fj-kernel/src/algorithms/sweep/vertex.rs @@ -92,33 +92,25 @@ impl Sweep for (Vertex, Handle) { ) }; - // And now the vertices. Again, nothing wild here. - let vertices = { - // Can be cleaned up, once `zip` is stable: - // https://doc.rust-lang.org/std/primitive.array.html#method.zip - let [a_surface, b_surface] = points_surface; - let [a_global, b_global] = vertices_global; - let vertices_surface = - [(a_surface, a_global), (b_surface, b_global)].map( - |(point_surface, vertex_global)| { - SurfaceVertex::new( - point_surface, - surface.clone(), - vertex_global, - objects, - ) - }, - ); + let vertices_surface = { + let [_, position] = points_surface; + let [_, global_form] = vertices_global; - vertices_surface.map(|surface_form| { - Vertex::new( - [surface_form.position().v], - curve.clone(), - surface_form, - ) - }) + [ + vertex.surface_form().clone(), + SurfaceVertex::new(position, surface, global_form, objects), + ] }; + // And now the vertices. Again, nothing wild here. + let vertices = vertices_surface.map(|surface_form| { + Vertex::new( + [surface_form.position().v], + curve.clone(), + surface_form, + ) + }); + // And finally, creating the output `Edge` is just a matter of // assembling the pieces we've already created. HalfEdge::new(vertices, edge_global)