From d15d090b5b586b175ea71ba129ab8734918c6c28 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 11:47:32 +0100 Subject: [PATCH 01/12] Refactor --- crates/fj-kernel/src/builder/shell.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index 1e2006ba5..d35c6307a 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -322,8 +322,11 @@ impl ShellBuilder for PartialShell { half_edges.push(Partial::from_partial(half_edge)); } + let mut exterior = PartialCycle::default(); + exterior.half_edges.extend(half_edges); + PartialFace { - exterior: Partial::from_partial(PartialCycle { half_edges }), + exterior: Partial::from_partial(exterior), ..Default::default() } }; From f145eec57ba46f93f6da2162e0abb2dfb5cb4638 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 11:49:26 +0100 Subject: [PATCH 02/12] Make variable name more explicit --- crates/fj-operations/src/sketch.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index c34e44682..e4e05620b 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -43,12 +43,12 @@ impl Shape for fj::Sketch { Partial::from_partial(half_edge) }; - let cycle = Partial::from_partial(PartialCycle { + let exterior = Partial::from_partial(PartialCycle { half_edges: vec![half_edge], }); PartialFace { - exterior: cycle, + exterior, color: Some(Color(self.color())), ..Default::default() } From 6b61db0a9df314b6dbae0aade27b398b7967eb65 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 11:51:56 +0100 Subject: [PATCH 03/12] Refactor --- crates/fj-operations/src/sketch.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index e4e05620b..93c67aaa6 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -43,9 +43,11 @@ impl Shape for fj::Sketch { Partial::from_partial(half_edge) }; - let exterior = Partial::from_partial(PartialCycle { - half_edges: vec![half_edge], - }); + let exterior = { + let mut cycle = PartialCycle::default(); + cycle.half_edges.push(half_edge); + Partial::from_partial(cycle) + }; PartialFace { exterior, From 637400e350fce6e86f35cc60e2e27a9124023c20 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 11:55:32 +0100 Subject: [PATCH 04/12] Remove unused method --- crates/fj-kernel/src/partial/objects/cycle.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index ba1f21fb8..7718f52ad 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -1,5 +1,5 @@ use crate::{ - objects::{Cycle, HalfEdge, Objects, Surface}, + objects::{Cycle, HalfEdge, Objects}, partial::{FullToPartialCache, Partial, PartialObject}, services::Service, }; @@ -11,15 +11,6 @@ pub struct PartialCycle { pub half_edges: Vec>, } -impl PartialCycle { - /// Access the surface of the [`Cycle`] - pub fn surface(&self) -> Option> { - self.half_edges - .first() - .map(|half_edge| half_edge.read().curve().read().surface.clone()) - } -} - impl PartialObject for PartialCycle { type Full = Cycle; From 4a7222b9754dab85e711d1040629fe9a6d919301 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:02:13 +0100 Subject: [PATCH 05/12] Add `surface` field to `PartialCycle` This is redundant right now, but I'm going to change `CycleBuilder` to use that field for new half-edges. This will make it possible to define the surface of a cycle, before adding any half-edges. --- crates/fj-kernel/src/partial/objects/cycle.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/partial/objects/cycle.rs b/crates/fj-kernel/src/partial/objects/cycle.rs index 7718f52ad..e1d109555 100644 --- a/crates/fj-kernel/src/partial/objects/cycle.rs +++ b/crates/fj-kernel/src/partial/objects/cycle.rs @@ -1,5 +1,5 @@ use crate::{ - objects::{Cycle, HalfEdge, Objects}, + objects::{Cycle, HalfEdge, Objects, Surface}, partial::{FullToPartialCache, Partial, PartialObject}, services::Service, }; @@ -7,6 +7,9 @@ use crate::{ /// A partial [`Cycle`] #[derive(Clone, Debug, Default)] pub struct PartialCycle { + /// The surface that the cycle is defined in + pub surface: Partial, + /// The half-edges that make up the cycle pub half_edges: Vec>, } @@ -16,6 +19,7 @@ impl PartialObject for PartialCycle { fn from_full(cycle: &Self::Full, cache: &mut FullToPartialCache) -> Self { Self { + surface: Partial::from_full(cycle.surface().clone(), cache), half_edges: cycle .half_edges() .cloned() From cea12aa6b2efe128c3d4300620d1d79f192e60fa Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:05:31 +0100 Subject: [PATCH 06/12] Use `PartialCycle`'s `surface` when adding edges --- crates/fj-kernel/src/builder/cycle.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/builder/cycle.rs b/crates/fj-kernel/src/builder/cycle.rs index 4944c8b61..6f109bbb2 100644 --- a/crates/fj-kernel/src/builder/cycle.rs +++ b/crates/fj-kernel/src/builder/cycle.rs @@ -52,14 +52,14 @@ impl CycleBuilder for PartialCycle { surface: impl Into>, points: impl IntoIterator>>, ) -> Vec> { - let surface = surface.into(); let mut points = points.into_iter().map(Into::into); + self.surface = surface.into(); + let mut half_edges = Vec::new(); if let Some(point) = points.next() { - let mut half_edge = self.add_half_edge_from_point_to_start(point); - half_edge.write().replace_surface(surface); + let half_edge = self.add_half_edge_from_point_to_start(point); half_edges.push(half_edge); } @@ -111,13 +111,12 @@ impl CycleBuilder for PartialCycle { { let shared_surface_vertex = first_half_edge.read().back().read().surface_form.clone(); - let shared_surface = shared_surface_vertex.read().surface.clone(); let mut new_half_edge = new_half_edge.write(); new_half_edge.front_mut().write().surface_form = shared_surface_vertex; - new_half_edge.replace_surface(shared_surface); + new_half_edge.replace_surface(self.surface.clone()); new_half_edge.infer_global_form(); } From fed44a53ea493c4b4b9c5e7e08b26ad8ff3164d2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:11:25 +0100 Subject: [PATCH 07/12] Remove redundant method argument --- crates/fj-kernel/src/builder/cycle.rs | 6 +----- crates/fj-kernel/src/builder/face.rs | 14 ++++++++++---- crates/fj-kernel/src/iter.rs | 10 +++++----- crates/fj-kernel/src/validate/cycle.rs | 10 +++++----- crates/fj-kernel/src/validate/face.rs | 12 ++++++------ 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/crates/fj-kernel/src/builder/cycle.rs b/crates/fj-kernel/src/builder/cycle.rs index 6f109bbb2..cc34a6d36 100644 --- a/crates/fj-kernel/src/builder/cycle.rs +++ b/crates/fj-kernel/src/builder/cycle.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - objects::{HalfEdge, Surface}, + objects::HalfEdge, partial::{Partial, PartialCycle}, }; @@ -12,7 +12,6 @@ pub trait CycleBuilder { /// Create a cycle as a polygonal chain from the provided points fn update_as_polygon_from_points( &mut self, - surface: impl Into>, points: impl IntoIterator>>, ) -> Vec>; @@ -49,13 +48,10 @@ pub trait CycleBuilder { impl CycleBuilder for PartialCycle { fn update_as_polygon_from_points( &mut self, - surface: impl Into>, points: impl IntoIterator>>, ) -> Vec> { let mut points = points.into_iter().map(Into::into); - self.surface = surface.into(); - let mut half_edges = Vec::new(); if let Some(point) = points.next() { diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index c2c0669b8..1c804ddf9 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -30,8 +30,11 @@ impl FaceBuilder for PartialFace { surface: impl Into>, points: impl IntoIterator>>, ) -> Vec> { - let mut cycle = PartialCycle::default(); - let half_edges = cycle.update_as_polygon_from_points(surface, points); + let mut cycle = PartialCycle { + surface: surface.into(), + ..Default::default() + }; + let half_edges = cycle.update_as_polygon_from_points(points); self.exterior = Partial::from_partial(cycle); @@ -43,8 +46,11 @@ impl FaceBuilder for PartialFace { surface: impl Into>, points: impl IntoIterator>>, ) { - let mut cycle = PartialCycle::default(); - cycle.update_as_polygon_from_points(surface, points); + let mut cycle = PartialCycle { + surface: surface.into(), + ..Default::default() + }; + cycle.update_as_polygon_from_points(points); self.interiors.push(Partial::from_partial(cycle)); } diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index 5fd84832a..c8a79d46e 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -408,11 +408,11 @@ mod tests { let surface = services.objects.surfaces.xy_plane(); let object = { - let mut cycle = PartialCycle::default(); - cycle.update_as_polygon_from_points( - surface, - [[0., 0.], [1., 0.], [0., 1.]], - ); + let mut cycle = PartialCycle { + surface: surface.into(), + ..Default::default() + }; + cycle.update_as_polygon_from_points([[0., 0.], [1., 0.], [0., 1.]]); cycle .build(&mut services.objects) .insert(&mut services.objects) diff --git a/crates/fj-kernel/src/validate/cycle.rs b/crates/fj-kernel/src/validate/cycle.rs index d0731ec56..1fd6b2fb8 100644 --- a/crates/fj-kernel/src/validate/cycle.rs +++ b/crates/fj-kernel/src/validate/cycle.rs @@ -78,11 +78,11 @@ mod tests { let mut services = Services::new(); let valid = { - let mut cycle = PartialCycle::default(); - cycle.update_as_polygon_from_points( - services.objects.surfaces.xy_plane(), - [[0., 0.], [1., 0.], [0., 1.]], - ); + let mut cycle = PartialCycle { + surface: Partial::from(services.objects.surfaces.xy_plane()), + ..Default::default() + }; + cycle.update_as_polygon_from_points([[0., 0.], [1., 0.], [0., 1.]]); cycle.build(&mut services.objects) }; let invalid = { diff --git a/crates/fj-kernel/src/validate/face.rs b/crates/fj-kernel/src/validate/face.rs index 9a84917b7..2942f5eef 100644 --- a/crates/fj-kernel/src/validate/face.rs +++ b/crates/fj-kernel/src/validate/face.rs @@ -108,7 +108,7 @@ mod tests { builder::{CycleBuilder, FaceBuilder}, insert::Insert, objects::Face, - partial::{PartialCycle, PartialFace, PartialObject}, + partial::{Partial, PartialCycle, PartialFace, PartialObject}, services::Services, validate::Validate, }; @@ -130,11 +130,11 @@ mod tests { face.build(&mut services.objects) }; let invalid = { - let mut cycle = PartialCycle::default(); - cycle.update_as_polygon_from_points( - services.objects.surfaces.xz_plane(), - [[1., 1.], [1., 2.], [2., 1.]], - ); + let mut cycle = PartialCycle { + surface: Partial::from(services.objects.surfaces.xz_plane()), + ..Default::default() + }; + cycle.update_as_polygon_from_points([[1., 1.], [1., 2.], [2., 1.]]); let cycle = cycle .build(&mut services.objects) .insert(&mut services.objects); From 3bdc46e8fa679de56625cf17889ee404358538b7 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:15:14 +0100 Subject: [PATCH 08/12] Simplify `FaceBuilder::update_exterior_as_polygon` --- crates/fj-kernel/src/builder/face.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index 1c804ddf9..622c9083d 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -30,15 +30,8 @@ impl FaceBuilder for PartialFace { surface: impl Into>, points: impl IntoIterator>>, ) -> Vec> { - let mut cycle = PartialCycle { - surface: surface.into(), - ..Default::default() - }; - let half_edges = cycle.update_as_polygon_from_points(points); - - self.exterior = Partial::from_partial(cycle); - - half_edges + self.exterior.write().surface = surface.into(); + self.exterior.write().update_as_polygon_from_points(points) } fn add_interior_polygon( From 8c5b5ca4a5ec61bd6cf61ac5f4f683776c2a79a8 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:16:34 +0100 Subject: [PATCH 09/12] Create `Partial` only once This doesn't really make a difference in functionality, but it seems a bit cleaner, and possibly more robust in the face of future changes. --- crates/fj-kernel/src/algorithms/intersect/curve_face.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index 5bdc07ff8..f61977e73 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -161,10 +161,10 @@ mod tests { fn compute() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); + let surface = Partial::from(services.objects.surfaces.xy_plane()); let mut curve = PartialCurve { - surface: Partial::from(surface.clone()), + surface: surface.clone(), ..Default::default() }; curve.update_as_line_from_points([[-3., 0.], [-2., 0.]]); From 0b33e56bb3ffbb6b08ac02292cd4d2558e794eac Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:19:22 +0100 Subject: [PATCH 10/12] Inline variables --- .../src/algorithms/intersect/face_point.rs | 24 +++++++------------ .../src/algorithms/intersect/ray_face.rs | 21 ++++++---------- .../src/algorithms/triangulate/mod.rs | 6 +++-- crates/fj-kernel/src/iter.rs | 6 ++--- 4 files changed, 21 insertions(+), 36 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/face_point.rs b/crates/fj-kernel/src/algorithms/intersect/face_point.rs index 1ab7f6879..6b713a2c0 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_point.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_point.rs @@ -147,10 +147,9 @@ mod tests { fn point_is_outside_face() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [1., 1.], [0., 2.]], ); let face = face @@ -166,10 +165,9 @@ mod tests { fn ray_hits_vertex_while_passing_outside() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [2., 1.], [0., 2.]], ); let face = face @@ -188,10 +186,9 @@ mod tests { fn ray_hits_vertex_at_cycle_seam() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[4., 2.], [0., 4.], [0., 0.]], ); let face = face @@ -210,10 +207,9 @@ mod tests { fn ray_hits_vertex_while_staying_inside() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [2., 1.], [3., 0.], [3., 4.]], ); let face = face @@ -232,10 +228,9 @@ mod tests { fn ray_hits_parallel_edge_and_leaves_face_at_vertex() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [2., 1.], [3., 1.], [0., 2.]], ); let face = face @@ -254,10 +249,9 @@ mod tests { fn ray_hits_parallel_edge_and_does_not_leave_face_there() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [2., 1.], [3., 1.], [4., 0.], [4., 5.]], ); let face = face @@ -276,10 +270,9 @@ mod tests { fn point_is_coincident_with_edge() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [2., 0.], [0., 1.]], ); let face = face @@ -307,10 +300,9 @@ mod tests { fn point_is_coincident_with_vertex() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [1., 0.], [0., 1.]], ); let face = face diff --git a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs index 7d1e22a8d..3418b62d3 100644 --- a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs @@ -165,10 +165,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.yz_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.yz_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face @@ -185,10 +184,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.yz_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.yz_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face @@ -208,10 +206,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.yz_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.yz_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face @@ -228,10 +225,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.yz_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.yz_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face @@ -259,10 +255,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.yz_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.yz_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face @@ -288,10 +283,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face @@ -310,10 +304,9 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], ); let face = face diff --git a/crates/fj-kernel/src/algorithms/triangulate/mod.rs b/crates/fj-kernel/src/algorithms/triangulate/mod.rs index 6779e26c7..e0814812e 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/mod.rs @@ -96,9 +96,11 @@ mod tests { let c = [2., 2.]; let d = [0., 1.]; - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface, [a, b, c, d]); + face.update_exterior_as_polygon( + services.objects.surfaces.xy_plane(), + [a, b, c, d], + ); let face = face .build(&mut services.objects) .insert(&mut services.objects); diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index c8a79d46e..bbf167934 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -435,10 +435,9 @@ mod tests { fn face() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut object = PartialFace::default(); object.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [1., 0.], [0., 1.]], ); let object = object @@ -554,10 +553,9 @@ mod tests { fn sketch() { let mut services = Services::new(); - let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); face.update_exterior_as_polygon( - surface, + services.objects.surfaces.xy_plane(), [[0., 0.], [1., 0.], [0., 1.]], ); let object = PartialSketch { From a8aa325b18ba5b2b5609627889b00c4381126cfb Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:46:44 +0100 Subject: [PATCH 11/12] Remove redundant method argument --- .../src/algorithms/intersect/curve_face.rs | 3 +- .../src/algorithms/intersect/face_face.rs | 6 +- .../src/algorithms/intersect/face_point.rs | 74 +++++++++------- .../src/algorithms/intersect/ray_face.rs | 86 ++++++++++++------- crates/fj-kernel/src/algorithms/sweep/face.rs | 21 +++-- .../src/algorithms/triangulate/mod.rs | 15 ++-- crates/fj-kernel/src/builder/face.rs | 3 - crates/fj-kernel/src/builder/shell.rs | 11 ++- crates/fj-kernel/src/builder/sketch.rs | 3 +- crates/fj-kernel/src/iter.rs | 14 ++- crates/fj-kernel/src/validate/face.rs | 12 +-- crates/fj-operations/src/sketch.rs | 3 +- 12 files changed, 145 insertions(+), 106 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index f61977e73..e1b1e86d1 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -187,7 +187,8 @@ mod tests { let face = { let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface.clone(), exterior); + face.exterior.write().surface = surface.clone(); + face.update_exterior_as_polygon(exterior); face.add_interior_polygon(surface, interior); face.build(&mut services.objects) diff --git a/crates/fj-kernel/src/algorithms/intersect/face_face.rs b/crates/fj-kernel/src/algorithms/intersect/face_face.rs index 2a619779b..adf9a5496 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_face.rs @@ -94,7 +94,8 @@ mod tests { ] .map(|surface| { let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface, points); + face.exterior.write().surface = Partial::from(surface); + face.update_exterior_as_polygon(points); face.build(&mut services.objects) }); @@ -122,7 +123,8 @@ mod tests { ]; let [a, b] = surfaces.clone().map(|surface| { let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface, points); + face.exterior.write().surface = Partial::from(surface); + face.update_exterior_as_polygon(points); face.build(&mut services.objects) }); diff --git a/crates/fj-kernel/src/algorithms/intersect/face_point.rs b/crates/fj-kernel/src/algorithms/intersect/face_point.rs index 6b713a2c0..78c2dcade 100644 --- a/crates/fj-kernel/src/algorithms/intersect/face_point.rs +++ b/crates/fj-kernel/src/algorithms/intersect/face_point.rs @@ -139,7 +139,7 @@ mod tests { builder::FaceBuilder, insert::Insert, iter::ObjectIters, - partial::{PartialFace, PartialObject}, + partial::{Partial, PartialFace, PartialObject}, services::Services, }; @@ -148,10 +148,9 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [1., 1.], [0., 2.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([[0., 0.], [1., 1.], [0., 2.]]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -166,10 +165,9 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [2., 1.], [0., 2.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([[0., 0.], [2., 1.], [0., 2.]]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -187,10 +185,9 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[4., 2.], [0., 4.], [0., 0.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([[4., 2.], [0., 4.], [0., 0.]]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -208,10 +205,14 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [2., 1.], [3., 0.], [3., 4.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([ + [0., 0.], + [2., 1.], + [3., 0.], + [3., 4.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -229,10 +230,14 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [2., 1.], [3., 1.], [0., 2.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([ + [0., 0.], + [2., 1.], + [3., 1.], + [0., 2.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -250,10 +255,15 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [2., 1.], [3., 1.], [4., 0.], [4., 5.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([ + [0., 0.], + [2., 1.], + [3., 1.], + [4., 0.], + [4., 5.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -271,10 +281,9 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [2., 0.], [0., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([[0., 0.], [2., 0.], [0., 1.]]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -301,10 +310,9 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [1., 0.], [0., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([[0., 0.], [1., 0.], [0., 1.]]); let face = face .build(&mut services.objects) .insert(&mut services.objects); diff --git a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs index 3418b62d3..4ed0094db 100644 --- a/crates/fj-kernel/src/algorithms/intersect/ray_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/ray_face.rs @@ -155,7 +155,7 @@ mod tests { builder::FaceBuilder, insert::Insert, iter::ObjectIters, - partial::{PartialFace, PartialObject}, + partial::{Partial, PartialFace, PartialObject}, services::Services, }; @@ -166,10 +166,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.yz_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.yz_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects) @@ -185,10 +189,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.yz_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.yz_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects) @@ -207,10 +215,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.yz_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.yz_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects) @@ -226,10 +238,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.yz_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.yz_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects) @@ -256,10 +272,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.yz_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.yz_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects) @@ -284,10 +304,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -305,10 +329,14 @@ mod tests { let ray = HorizontalRayToTheRight::from([0., 0., 0.]); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[-1., -1.], [1., -1.], [1., 1.], [-1., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([ + [-1., -1.], + [1., -1.], + [1., 1.], + [-1., 1.], + ]); let face = face .build(&mut services.objects) .insert(&mut services.objects) diff --git a/crates/fj-kernel/src/algorithms/sweep/face.rs b/crates/fj-kernel/src/algorithms/sweep/face.rs index 815f05b97..799803854 100644 --- a/crates/fj-kernel/src/algorithms/sweep/face.rs +++ b/crates/fj-kernel/src/algorithms/sweep/face.rs @@ -89,7 +89,9 @@ mod tests { algorithms::{reverse::Reverse, transform::TransformObject}, builder::{FaceBuilder, HalfEdgeBuilder, SketchBuilder}, insert::Insert, - partial::{PartialFace, PartialHalfEdge, PartialObject, PartialSketch}, + partial::{ + Partial, PartialFace, PartialHalfEdge, PartialObject, PartialSketch, + }, services::Services, }; @@ -113,16 +115,16 @@ mod tests { .sweep(UP, &mut services.objects); let mut bottom = PartialFace::default(); - bottom.update_exterior_as_polygon(surface.clone(), TRIANGLE); + bottom.exterior.write().surface = Partial::from(surface.clone()); + bottom.update_exterior_as_polygon(TRIANGLE); let bottom = bottom .build(&mut services.objects) .insert(&mut services.objects) .reverse(&mut services.objects); let mut top = PartialFace::default(); - top.update_exterior_as_polygon( - surface.translate(UP, &mut services.objects), - TRIANGLE, - ); + top.exterior.write().surface = + Partial::from(surface.translate(UP, &mut services.objects)); + top.update_exterior_as_polygon(TRIANGLE); let top = top .build(&mut services.objects) .insert(&mut services.objects); @@ -164,16 +166,17 @@ mod tests { .sweep(DOWN, &mut services.objects); let mut bottom = PartialFace::default(); - bottom.update_exterior_as_polygon( + bottom.exterior.write().surface = Partial::from( surface.clone().translate(DOWN, &mut services.objects), - TRIANGLE, ); + bottom.update_exterior_as_polygon(TRIANGLE); let bottom = bottom .build(&mut services.objects) .insert(&mut services.objects) .reverse(&mut services.objects); let mut top = PartialFace::default(); - top.update_exterior_as_polygon(surface, TRIANGLE); + top.exterior.write().surface = Partial::from(surface); + top.update_exterior_as_polygon(TRIANGLE); let top = top .build(&mut services.objects) .insert(&mut services.objects); diff --git a/crates/fj-kernel/src/algorithms/triangulate/mod.rs b/crates/fj-kernel/src/algorithms/triangulate/mod.rs index e0814812e..33e1a619a 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/mod.rs @@ -80,7 +80,7 @@ mod tests { builder::FaceBuilder, insert::Insert, objects::Face, - partial::{PartialFace, PartialObject}, + partial::{Partial, PartialFace, PartialObject}, services::Services, storage::Handle, }; @@ -97,10 +97,9 @@ mod tests { let d = [0., 1.]; let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [a, b, c, d], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([a, b, c, d]); let face = face .build(&mut services.objects) .insert(&mut services.objects); @@ -136,7 +135,8 @@ mod tests { let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface.clone(), [a, b, c, d]); + face.exterior.write().surface = Partial::from(surface.clone()); + face.update_exterior_as_polygon([a, b, c, d]); face.add_interior_polygon(surface.clone(), [e, f, g, h]); let face = face .build(&mut services.objects) @@ -195,7 +195,8 @@ mod tests { let surface = services.objects.surfaces.xy_plane(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface.clone(), [a, b, c, d, e]); + face.exterior.write().surface = Partial::from(surface.clone()); + face.update_exterior_as_polygon([a, b, c, d, e]); let face = face .build(&mut services.objects) .insert(&mut services.objects); diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index 622c9083d..cff251328 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -12,7 +12,6 @@ pub trait FaceBuilder { /// Update the [`PartialFace`] with an exterior polygon fn update_exterior_as_polygon( &mut self, - surface: impl Into>, points: impl IntoIterator>>, ) -> Vec>; @@ -27,10 +26,8 @@ pub trait FaceBuilder { impl FaceBuilder for PartialFace { fn update_exterior_as_polygon( &mut self, - surface: impl Into>, points: impl IntoIterator>>, ) -> Vec> { - self.exterior.write().surface = surface.into(); self.exterior.write().update_as_polygon_from_points(points) } diff --git a/crates/fj-kernel/src/builder/shell.rs b/crates/fj-kernel/src/builder/shell.rs index d35c6307a..77d952867 100644 --- a/crates/fj-kernel/src/builder/shell.rs +++ b/crates/fj-kernel/src/builder/shell.rs @@ -42,10 +42,13 @@ impl ShellBuilder for PartialShell { objects.surfaces.xy_plane().translate([Z, Z, -h], objects); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - surface, - [[-h, -h], [h, -h], [h, h], [-h, h]], - ); + face.exterior.write().surface = Partial::from(surface); + face.update_exterior_as_polygon([ + [-h, -h], + [h, -h], + [h, h], + [-h, h], + ]); face }; diff --git a/crates/fj-kernel/src/builder/sketch.rs b/crates/fj-kernel/src/builder/sketch.rs index c100f0d6f..1436ad2cd 100644 --- a/crates/fj-kernel/src/builder/sketch.rs +++ b/crates/fj-kernel/src/builder/sketch.rs @@ -24,7 +24,8 @@ impl SketchBuilder for PartialSketch { points: impl IntoIterator>>, ) { let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface, points); + face.exterior.write().surface = surface.into(); + face.update_exterior_as_polygon(points); self.faces.extend([Partial::from_partial(face)]); } diff --git a/crates/fj-kernel/src/iter.rs b/crates/fj-kernel/src/iter.rs index bbf167934..8a7353747 100644 --- a/crates/fj-kernel/src/iter.rs +++ b/crates/fj-kernel/src/iter.rs @@ -436,10 +436,9 @@ mod tests { let mut services = Services::new(); let mut object = PartialFace::default(); - object.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [1., 0.], [0., 1.]], - ); + object.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + object.update_exterior_as_polygon([[0., 0.], [1., 0.], [0., 1.]]); let object = object .build(&mut services.objects) .insert(&mut services.objects); @@ -554,10 +553,9 @@ mod tests { let mut services = Services::new(); let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - services.objects.surfaces.xy_plane(), - [[0., 0.], [1., 0.], [0., 1.]], - ); + face.exterior.write().surface = + Partial::from(services.objects.surfaces.xy_plane()); + face.update_exterior_as_polygon([[0., 0.], [1., 0.], [0., 1.]]); let object = PartialSketch { faces: vec![Partial::from_partial(face)], } diff --git a/crates/fj-kernel/src/validate/face.rs b/crates/fj-kernel/src/validate/face.rs index 2942f5eef..cce49ab10 100644 --- a/crates/fj-kernel/src/validate/face.rs +++ b/crates/fj-kernel/src/validate/face.rs @@ -121,10 +121,8 @@ mod tests { let valid = { let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - surface.clone(), - [[0., 0.], [3., 0.], [0., 3.]], - ); + face.exterior.write().surface = Partial::from(surface.clone()); + face.update_exterior_as_polygon([[0., 0.], [3., 0.], [0., 3.]]); face.add_interior_polygon(surface, [[1., 1.], [1., 2.], [2., 1.]]); face.build(&mut services.objects) @@ -155,10 +153,8 @@ mod tests { let valid = { let mut face = PartialFace::default(); - face.update_exterior_as_polygon( - surface.clone(), - [[0., 0.], [3., 0.], [0., 3.]], - ); + face.exterior.write().surface = Partial::from(surface.clone()); + face.update_exterior_as_polygon([[0., 0.], [3., 0.], [0., 3.]]); face.add_interior_polygon(surface, [[1., 1.], [1., 2.], [2., 1.]]); face.build(&mut services.objects) }; diff --git a/crates/fj-operations/src/sketch.rs b/crates/fj-operations/src/sketch.rs index 93c67aaa6..61318cce6 100644 --- a/crates/fj-operations/src/sketch.rs +++ b/crates/fj-operations/src/sketch.rs @@ -63,7 +63,8 @@ impl Shape for fj::Sketch { .map(Point::from); let mut face = PartialFace::default(); - face.update_exterior_as_polygon(surface, points); + face.exterior.write().surface = Partial::from(surface); + face.update_exterior_as_polygon(points); face.color = Some(Color(self.color())); face From 649e3131a4853286fb1306706251c033eadfeea5 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 20 Dec 2022 12:49:01 +0100 Subject: [PATCH 12/12] Remove redundant method argument --- crates/fj-kernel/src/algorithms/intersect/curve_face.rs | 4 ++-- crates/fj-kernel/src/algorithms/triangulate/mod.rs | 2 +- crates/fj-kernel/src/builder/face.rs | 6 ++---- crates/fj-kernel/src/validate/face.rs | 8 ++++---- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs index e1b1e86d1..06d049cc2 100644 --- a/crates/fj-kernel/src/algorithms/intersect/curve_face.rs +++ b/crates/fj-kernel/src/algorithms/intersect/curve_face.rs @@ -187,9 +187,9 @@ mod tests { let face = { let mut face = PartialFace::default(); - face.exterior.write().surface = surface.clone(); + face.exterior.write().surface = surface; face.update_exterior_as_polygon(exterior); - face.add_interior_polygon(surface, interior); + face.add_interior_polygon(interior); face.build(&mut services.objects) }; diff --git a/crates/fj-kernel/src/algorithms/triangulate/mod.rs b/crates/fj-kernel/src/algorithms/triangulate/mod.rs index 33e1a619a..695c7aad0 100644 --- a/crates/fj-kernel/src/algorithms/triangulate/mod.rs +++ b/crates/fj-kernel/src/algorithms/triangulate/mod.rs @@ -137,7 +137,7 @@ mod tests { let mut face = PartialFace::default(); face.exterior.write().surface = Partial::from(surface.clone()); face.update_exterior_as_polygon([a, b, c, d]); - face.add_interior_polygon(surface.clone(), [e, f, g, h]); + face.add_interior_polygon([e, f, g, h]); let face = face .build(&mut services.objects) .insert(&mut services.objects); diff --git a/crates/fj-kernel/src/builder/face.rs b/crates/fj-kernel/src/builder/face.rs index cff251328..bc1c49ee9 100644 --- a/crates/fj-kernel/src/builder/face.rs +++ b/crates/fj-kernel/src/builder/face.rs @@ -1,7 +1,7 @@ use fj_math::Point; use crate::{ - objects::{HalfEdge, Surface}, + objects::HalfEdge, partial::{Partial, PartialCycle, PartialFace}, }; @@ -18,7 +18,6 @@ pub trait FaceBuilder { /// Update the [`PartialFace`] with an interior polygon fn add_interior_polygon( &mut self, - surface: impl Into>, points: impl IntoIterator>>, ); } @@ -33,11 +32,10 @@ impl FaceBuilder for PartialFace { fn add_interior_polygon( &mut self, - surface: impl Into>, points: impl IntoIterator>>, ) { let mut cycle = PartialCycle { - surface: surface.into(), + surface: self.exterior.read().surface.clone(), ..Default::default() }; cycle.update_as_polygon_from_points(points); diff --git a/crates/fj-kernel/src/validate/face.rs b/crates/fj-kernel/src/validate/face.rs index cce49ab10..893683beb 100644 --- a/crates/fj-kernel/src/validate/face.rs +++ b/crates/fj-kernel/src/validate/face.rs @@ -121,9 +121,9 @@ mod tests { let valid = { let mut face = PartialFace::default(); - face.exterior.write().surface = Partial::from(surface.clone()); + face.exterior.write().surface = Partial::from(surface); face.update_exterior_as_polygon([[0., 0.], [3., 0.], [0., 3.]]); - face.add_interior_polygon(surface, [[1., 1.], [1., 2.], [2., 1.]]); + face.add_interior_polygon([[1., 1.], [1., 2.], [2., 1.]]); face.build(&mut services.objects) }; @@ -153,9 +153,9 @@ mod tests { let valid = { let mut face = PartialFace::default(); - face.exterior.write().surface = Partial::from(surface.clone()); + face.exterior.write().surface = Partial::from(surface); face.update_exterior_as_polygon([[0., 0.], [3., 0.], [0., 3.]]); - face.add_interior_polygon(surface, [[1., 1.], [1., 2.], [2., 1.]]); + face.add_interior_polygon([[1., 1.], [1., 2.], [2., 1.]]); face.build(&mut services.objects) }; let invalid = {