diff --git a/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs b/crates/fj-kernel/src/algorithms/intersect/surface_surface.rs index 969f5736f..0f643519e 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. // @@ -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 global = store.global_curves.insert(GlobalCurve::from_path( - GlobalPath::Line(Line::from_origin_and_direction( - origin, direction, + 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) + Curve::new(surface, path, global_form) }); Some(Self { 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(); diff --git a/crates/fj-kernel/src/builder/curve.rs b/crates/fj-kernel/src/builder/curve.rs index a9e0b3f3d..db9e5f5df 100644 --- a/crates/fj-kernel/src/builder/curve.rs +++ b/crates/fj-kernel/src/builder/curve.rs @@ -51,15 +51,15 @@ 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 global = self.stores.global_curves.insert(GlobalCurve::from_path( - GlobalPath::Line(Line::from_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 .map(|point| self.surface.point_from_surface_coords(point)), - )), - )); + ))), + ); - Curve::new(self.surface, SurfacePath::Line(local), global) + Curve::new(self.surface, path, global_form) } } diff --git a/crates/fj-kernel/src/builder/edge.rs b/crates/fj-kernel/src/builder/edge.rs index e5b074c9a..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 = @@ -90,7 +89,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 +97,7 @@ impl<'a> HalfEdgeBuilder<'a> { )) }; - Curve::new(self.surface, path, curve_global) + Curve::new(self.surface, path, global_form) }; let vertices = {