From fab693863dce03faae8046301405c1603646e320 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Oct 2022 17:00:42 +0200 Subject: [PATCH 1/3] Update variable name --- crates/fj-kernel/src/partial/objects/edge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index 0789c889c..c46b1d93c 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -93,14 +93,14 @@ impl PartialHalfEdge { let [a_curve, b_curve] = [Scalar::ZERO, Scalar::TAU].map(|coord| Point::from([coord])); - let global_vertex = Handle::::partial() + let global_form = Handle::::partial() .from_curve_and_position(curve.clone(), a_curve); [a_curve, b_curve].map(|point_curve| { Vertex::partial() .with_position(Some(point_curve)) .with_curve(Some(curve.clone())) - .with_global_form(Some(global_vertex.clone())) + .with_global_form(Some(global_form.clone())) }) }; From 9279d78a4eb1d51954a9387b5282526cef0bdc30 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Oct 2022 17:06:38 +0200 Subject: [PATCH 2/3] Fix `SurfaceVertex` duplication --- crates/fj-kernel/src/partial/objects/edge.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/fj-kernel/src/partial/objects/edge.rs b/crates/fj-kernel/src/partial/objects/edge.rs index c46b1d93c..eccdc378a 100644 --- a/crates/fj-kernel/src/partial/objects/edge.rs +++ b/crates/fj-kernel/src/partial/objects/edge.rs @@ -96,11 +96,16 @@ impl PartialHalfEdge { let global_form = Handle::::partial() .from_curve_and_position(curve.clone(), a_curve); + let path = curve.path.expect("Expected path that was just created"); + let surface_form = SurfaceVertex::partial() + .with_position(Some(path.point_from_path_coords(a_curve))) + .with_global_form(Some(global_form)); + [a_curve, b_curve].map(|point_curve| { Vertex::partial() .with_position(Some(point_curve)) .with_curve(Some(curve.clone())) - .with_global_form(Some(global_form.clone())) + .with_surface_form(Some(surface_form.clone())) }) }; From a1e235f028faa146cd8df95d04e651b7aabf0642 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Tue, 11 Oct 2022 16:58:09 +0200 Subject: [PATCH 3/3] Fix validation check in `Cycle` It didn't do the check, if the cycle had only one edge. --- crates/fj-kernel/src/objects/cycle.rs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/fj-kernel/src/objects/cycle.rs b/crates/fj-kernel/src/objects/cycle.rs index cfddc5fa9..b773303e8 100644 --- a/crates/fj-kernel/src/objects/cycle.rs +++ b/crates/fj-kernel/src/objects/cycle.rs @@ -53,19 +53,19 @@ impl Cycle { "Edges in cycle do not connect" ); } + } - // Verify that the edges form a cycle - if let Some(first) = half_edges.first() { - if let Some(last) = half_edges.last() { - let [first, _] = first.vertices(); - let [_, last] = last.vertices(); + // Verify that the edges form a cycle + if let Some(first) = half_edges.first() { + if let Some(last) = half_edges.last() { + let [first, _] = first.vertices(); + let [_, last] = last.vertices(); - assert_eq!( - first.surface_form(), - last.surface_form(), - "Edges do not form a cycle" - ); - } + assert_eq!( + first.surface_form(), + last.surface_form(), + "Edges do not form a cycle" + ); } }