From e84a943a74752c1f1db67882f619ae339878df0b Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 15:56:49 +0200 Subject: [PATCH 1/9] Make variable name more explicit --- .../src/algorithms/intersect/surface_surface.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index 969f5736f..e93ca9849 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -53,13 +53,13 @@ impl SurfaceSurfaceIntersection { let curves = planes_parametric.map(|(surface, plane)| { let local = project_line_into_plane(&line, &plane); - let global = store.global_curves.insert(GlobalCurve::from_path( - GlobalPath::Line(Line::from_origin_and_direction( - origin, direction, + let global_form = store.global_curves.insert( + GlobalCurve::from_path(GlobalPath::Line( + Line::from_origin_and_direction(origin, direction), )), - )); + ); - Curve::new(surface, local, global) + Curve::new(surface, local, global_form) }); Some(Self { From a521714ea2e1e5e4bfbceae5b9e4d1bc7e6756aa Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 15:57:31 +0200 Subject: [PATCH 2/9] Fix variable name --- crates/fj-kernel/src/algorithms/intersect/surface_surface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index e93ca9849..af8ea101c 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -15,7 +15,7 @@ pub struct SurfaceSurfaceIntersection { impl SurfaceSurfaceIntersection { /// Compute the intersection between two surfaces - pub fn compute(surfaces: [&Surface; 2], store: &Stores) -> Option { + pub fn compute(surfaces: [&Surface; 2], stores: &Stores) -> Option { // Algorithm from Real-Time Collision Detection by Christer Ericson. See // section 5.4.4, Intersection of Two Planes. // @@ -53,7 +53,7 @@ impl SurfaceSurfaceIntersection { let curves = planes_parametric.map(|(surface, plane)| { let local = project_line_into_plane(&line, &plane); - let global_form = store.global_curves.insert( + let global_form = stores.global_curves.insert( GlobalCurve::from_path(GlobalPath::Line( Line::from_origin_and_direction(origin, direction), )), From e487de265b54e1ce15a89a01cc7806a819221d8a Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 15:58:19 +0200 Subject: [PATCH 3/9] Update variable name The old name no longer reflected what this variable is. --- crates/fj-kernel/src/algorithms/intersect/surface_surface.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index af8ea101c..0f643519e 100644 --- a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs +++ b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs @@ -52,14 +52,14 @@ impl SurfaceSurfaceIntersection { let line = Line::from_origin_and_direction(origin, direction); let curves = planes_parametric.map(|(surface, plane)| { - let local = project_line_into_plane(&line, &plane); + let path = project_line_into_plane(&line, &plane); let global_form = stores.global_curves.insert( GlobalCurve::from_path(GlobalPath::Line( Line::from_origin_and_direction(origin, direction), )), ); - Curve::new(surface, local, global_form) + Curve::new(surface, path, global_form) }); Some(Self { From f942aa116adb6afc632fdd88e33f717872f4c60e Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 16:04:58 +0200 Subject: [PATCH 4/9] Make variable name more specific --- crates/fj-kernel/src/builder/curve.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/fj-kernel/src/builder/curve.rs b/crates/fj-kernel/src/builder/curve.rs index a9e0b3f3d..b2568a75a 100644 --- a/crates/fj-kernel/src/builder/curve.rs +++ b/crates/fj-kernel/src/builder/curve.rs @@ -52,14 +52,14 @@ impl<'a> CurveBuilder<'a> { let points = points.map(Into::into); let local = Line::from_points(points); - let global = self.stores.global_curves.insert(GlobalCurve::from_path( - GlobalPath::Line(Line::from_points( + let global_form = self.stores.global_curves.insert( + GlobalCurve::from_path(GlobalPath::Line(Line::from_points( points .map(|point| self.surface.point_from_surface_coords(point)), - )), - )); + ))), + ); - Curve::new(self.surface, SurfacePath::Line(local), global) + Curve::new(self.surface, SurfacePath::Line(local), global_form) } } From 0037ad7eb80471da100f19a928b85158af769464 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 16:08:39 +0200 Subject: [PATCH 5/9] Refactor --- crates/fj-kernel/src/builder/curve.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/builder/curve.rs b/crates/fj-kernel/src/builder/curve.rs index b2568a75a..21a3eb799 100644 --- a/crates/fj-kernel/src/builder/curve.rs +++ b/crates/fj-kernel/src/builder/curve.rs @@ -51,7 +51,7 @@ impl<'a> CurveBuilder<'a> { pub fn line_from_points(&self, points: [impl Into>; 2]) -> Curve { let points = points.map(Into::into); - let local = Line::from_points(points); + let local = SurfacePath::Line(Line::from_points(points)); let global_form = self.stores.global_curves.insert( GlobalCurve::from_path(GlobalPath::Line(Line::from_points( points @@ -59,7 +59,7 @@ impl<'a> CurveBuilder<'a> { ))), ); - Curve::new(self.surface, SurfacePath::Line(local), global_form) + Curve::new(self.surface, local, global_form) } } From b0042d892d10850e66d978657534721b01179438 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 16:09:03 +0200 Subject: [PATCH 6/9] Update variable name The old name no longer reflected what the variable is. --- crates/fj-kernel/src/builder/curve.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/builder/curve.rs b/crates/fj-kernel/src/builder/curve.rs index 21a3eb799..db9e5f5df 100644 --- a/crates/fj-kernel/src/builder/curve.rs +++ b/crates/fj-kernel/src/builder/curve.rs @@ -51,7 +51,7 @@ impl<'a> CurveBuilder<'a> { pub fn line_from_points(&self, points: [impl Into>; 2]) -> Curve { let points = points.map(Into::into); - let local = SurfacePath::Line(Line::from_points(points)); + let path = SurfacePath::Line(Line::from_points(points)); let global_form = self.stores.global_curves.insert( GlobalCurve::from_path(GlobalPath::Line(Line::from_points( points @@ -59,7 +59,7 @@ impl<'a> CurveBuilder<'a> { ))), ); - Curve::new(self.surface, local, global_form) + Curve::new(self.surface, path, global_form) } } From 19f759eb104a5980413094ba34d5c2720c7c7fc1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 17:25:52 +0200 Subject: [PATCH 7/9] Update variable name --- crates/fj-kernel/src/builder/edge.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index e5b074c9a..ebd47db11 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -90,7 +90,7 @@ impl<'a> HalfEdgeBuilder<'a> { let curve = { let path = SurfacePath::Line(Line::from_points(points)); - let curve_global = { + let global_form = { let points = global_vertices .map(|global_vertex| global_vertex.position()); self.stores.global_curves.insert(GlobalCurve::from_path( @@ -98,7 +98,7 @@ impl<'a> HalfEdgeBuilder<'a> { )) }; - Curve::new(self.surface, path, curve_global) + Curve::new(self.surface, path, global_form) }; let vertices = { From 2b46a0cdcd6544124aae3cb4dd55ee31ffd5c9ab Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 17:21:26 +0200 Subject: [PATCH 8/9] Bypass `GlobalCurve` in vertex validation --- crates/fj-kernel/src/algorithms/validate/coherence.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/algorithms/validate/coherence.rs b/crates/fj-kernel/src/algorithms/validate/coherence.rs index 91850c7c9..dc9b4581c 100644 --- a/crates/fj-kernel/src/algorithms/validate/coherence.rs +++ b/crates/fj-kernel/src/algorithms/validate/coherence.rs @@ -48,11 +48,11 @@ pub fn validate_vertex( // lies on the curve. let local = vertex.position(); + let local_as_surface = vertex.curve().path().point_from_path_coords(local); let local_as_global = vertex .curve() - .global_form() - .path() - .point_from_path_coords(local); + .surface() + .point_from_surface_coords(local_as_surface); let global = vertex.global_form().position(); let distance = (local_as_global - global).magnitude(); From f8d7923947df284d2e3df08c2f0cfe3d2c3fb3f1 Mon Sep 17 00:00:00 2001 From: Hanno Braun Date: Mon, 19 Sep 2022 17:24:53 +0200 Subject: [PATCH 9/9] Bypass `GlobalCurve` in `HalfEdgeBuilder` --- crates/fj-kernel/src/builder/edge.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index ebd47db11..26df2eb7b 100644 --- a/crates/fj-kernel/src/builder/edge.rs +++ b/crates/fj-kernel/src/builder/edge.rs @@ -32,9 +32,8 @@ impl<'a> HalfEdgeBuilder<'a> { let [a_curve, b_curve] = [Scalar::ZERO, Scalar::TAU].map(|coord| Point::from([coord])); - let global_vertex = GlobalVertex::from_position( - curve.global_form().path().point_from_path_coords(a_curve), - ); + let global_vertex = + GlobalVertex::build().from_curve_and_position(&curve, a_curve); let surface_vertices = [a_curve, b_curve].map(|point_curve| { let point_surface =