From 41c3559870a99522d95c59b9315d2d2ebbc00494 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 13 Oct 2022 16:59:56 +0200 Subject: [PATCH 1/5] Update variable name --- crates/fj-kernel/src/algorithms/sweep/edge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index af2d040a5..401c31eaa 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -208,7 +208,7 @@ mod tests { .as_line_segment_from_points([[0., 1.], [1., 1.]]) .build(&objects) .reverse(); - let left = HalfEdge::partial() + let side_down = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[0., 0.], [0., 1.]]) .build(&objects) @@ -218,7 +218,7 @@ mod tests { .as_line_segment_from_points([[1., 0.], [1., 1.]]) .build(&objects); - let cycle = Cycle::new(surface, [bottom, right, top, left]); + let cycle = Cycle::new(surface, [bottom, right, top, side_down]); Face::from_exterior(cycle) }; From 1af539c91822374374cbab029bfb25f65f2d04ff Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 13 Oct 2022 17:00:58 +0200 Subject: [PATCH 2/5] Update variable name --- crates/fj-kernel/src/algorithms/sweep/edge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index 401c31eaa..d95021a8f 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -213,12 +213,12 @@ mod tests { .as_line_segment_from_points([[0., 0.], [0., 1.]]) .build(&objects) .reverse(); - let right = HalfEdge::partial() + let side_up = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[1., 0.], [1., 1.]]) .build(&objects); - let cycle = Cycle::new(surface, [bottom, right, top, side_down]); + let cycle = Cycle::new(surface, [bottom, side_up, top, side_down]); Face::from_exterior(cycle) }; From 76d4ccc882b8e50ca19e3252b6b891fe920e84e2 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 13 Oct 2022 17:01:24 +0200 Subject: [PATCH 3/5] Update order of code --- crates/fj-kernel/src/algorithms/sweep/edge.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index d95021a8f..a9490e883 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -203,6 +203,10 @@ mod tests { .with_surface(Some(surface.clone())) .as_line_segment_from_points([[0., 0.], [1., 0.]]) .build(&objects); + let side_up = HalfEdge::partial() + .with_surface(Some(surface.clone())) + .as_line_segment_from_points([[1., 0.], [1., 1.]]) + .build(&objects); let top = HalfEdge::partial() .with_surface(Some(surface.clone())) .as_line_segment_from_points([[0., 1.], [1., 1.]]) @@ -213,10 +217,6 @@ mod tests { .as_line_segment_from_points([[0., 0.], [0., 1.]]) .build(&objects) .reverse(); - let side_up = HalfEdge::partial() - .with_surface(Some(surface.clone())) - .as_line_segment_from_points([[1., 0.], [1., 1.]]) - .build(&objects); let cycle = Cycle::new(surface, [bottom, side_up, top, side_down]); From f1fabce5da583ef6e8f6899293be930aa97d1a10 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Thu, 13 Oct 2022 17:08:09 +0200 Subject: [PATCH 4/5] Fix `SurfaceVertex` duplication in test code --- crates/fj-kernel/src/algorithms/sweep/edge.rs | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/sweep/edge.rs b/crates/fj-kernel/src/algorithms/sweep/edge.rs index a9490e883..ceac38a01 100644 --- a/crates/fj-kernel/src/algorithms/sweep/edge.rs +++ b/crates/fj-kernel/src/algorithms/sweep/edge.rs @@ -181,8 +181,9 @@ mod tests { use crate::{ algorithms::{reverse::Reverse, sweep::Sweep}, - objects::{Cycle, Face, HalfEdge, Objects}, + objects::{Cycle, Face, HalfEdge, Objects, SurfaceVertex, Vertex}, partial::HasPartial, + storage::Handle, }; #[test] @@ -205,16 +206,40 @@ mod tests { .build(&objects); let side_up = HalfEdge::partial() .with_surface(Some(surface.clone())) - .as_line_segment_from_points([[1., 0.], [1., 1.]]) + .with_back_vertex(Some(Vertex::partial().with_surface_form( + Some(bottom.front().surface_form().clone()), + ))) + .with_front_vertex(Some( + Vertex::partial().with_surface_form(Some( + Handle::::partial() + .with_position(Some([1., 1.])), + )), + )) + .as_line_segment() .build(&objects); let top = HalfEdge::partial() .with_surface(Some(surface.clone())) - .as_line_segment_from_points([[0., 1.], [1., 1.]]) + .with_back_vertex(Some( + Vertex::partial().with_surface_form(Some( + Handle::::partial() + .with_position(Some([0., 1.])), + )), + )) + .with_front_vertex(Some(Vertex::partial().with_surface_form( + Some(side_up.front().surface_form().clone()), + ))) + .as_line_segment() .build(&objects) .reverse(); let side_down = HalfEdge::partial() .with_surface(Some(surface.clone())) - .as_line_segment_from_points([[0., 0.], [0., 1.]]) + .with_back_vertex(Some(Vertex::partial().with_surface_form( + Some(bottom.back().surface_form().clone()), + ))) + .with_front_vertex(Some(Vertex::partial().with_surface_form( + Some(top.front().surface_form().clone()), + ))) + .as_line_segment() .build(&objects) .reverse(); From 96cd9fb57a2bf9c20a460af9f6f1a2ce34728997 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Wed, 12 Oct 2022 15:02:13 +0200 Subject: [PATCH 5/5] Increase strictness of cycle validation --- crates/fj-kernel/src/objects/cycle.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/objects/cycle.rs b/crates/fj-kernel/src/objects/cycle.rs index b773303e8..a2a527acc 100644 --- a/crates/fj-kernel/src/objects/cycle.rs +++ b/crates/fj-kernel/src/objects/cycle.rs @@ -48,8 +48,8 @@ impl Cycle { let [next, _] = b.vertices(); assert_eq!( - prev.surface_form(), - next.surface_form(), + prev.surface_form().id(), + next.surface_form().id(), "Edges in cycle do not connect" ); }