diff --git a/crates/fj-kernel/src/algorithms/approx/curve.rs b/crates/fj-kernel/src/algorithms/approx/curve.rs index b8597a00c..ec119345c 100644 --- a/crates/fj-kernel/src/algorithms/approx/curve.rs +++ b/crates/fj-kernel/src/algorithms/approx/curve.rs @@ -19,7 +19,7 @@ use crate::{ use super::{path::RangeOnPath, Approx, ApproxPoint, Tolerance}; -impl Approx for (&Handle, &Surface, RangeOnPath) { +impl Approx for (&Handle, &Surface, Handle, RangeOnPath) { type Approximation = CurveApprox; type Cache = CurveCache; @@ -28,9 +28,8 @@ impl Approx for (&Handle, &Surface, RangeOnPath) { tolerance: impl Into, cache: &mut Self::Cache, ) -> Self::Approximation { - let (curve, surface, range) = self; + let (curve, surface, global_curve, range) = self; - let global_curve = curve.global_form().clone(); let global_curve_approx = match cache.get(global_curve.clone(), range) { Some(approx) => approx, None => { @@ -237,7 +236,9 @@ mod tests { .insert(&mut services.objects); let range = RangeOnPath::from([[0.], [1.]]); - let approx = (&curve, surface.deref(), range).approx(1.); + let approx = + (&curve, surface.deref(), curve.global_form().clone(), range) + .approx(1.); assert_eq!(approx, CurveApprox::empty()); } @@ -259,7 +260,9 @@ mod tests { .insert(&mut services.objects); let range = RangeOnPath::from([[0.], [1.]]); - let approx = (&curve, surface.deref(), range).approx(1.); + let approx = + (&curve, surface.deref(), curve.global_form().clone(), range) + .approx(1.); assert_eq!(approx, CurveApprox::empty()); } @@ -281,7 +284,9 @@ mod tests { let range = RangeOnPath::from([[0.], [TAU]]); let tolerance = 1.; - let approx = (&curve, surface.deref(), range).approx(tolerance); + let approx = + (&curve, surface.deref(), curve.global_form().clone(), range) + .approx(tolerance); let expected_approx = (path, range) .approx(tolerance) @@ -310,7 +315,9 @@ mod tests { let range = RangeOnPath::from([[0.], [TAU]]); let tolerance = 1.; - let approx = (&curve, surface.deref(), range).approx(tolerance); + let approx = + (&curve, surface.deref(), curve.global_form().clone(), range) + .approx(tolerance); let expected_approx = (curve.path(), range) .approx(tolerance) diff --git a/crates/fj-kernel/src/algorithms/approx/edge.rs b/crates/fj-kernel/src/algorithms/approx/edge.rs index cefa0cee0..9d3226b24 100644 --- a/crates/fj-kernel/src/algorithms/approx/edge.rs +++ b/crates/fj-kernel/src/algorithms/approx/edge.rs @@ -35,7 +35,12 @@ impl Approx for (&Handle, &Surface) { half_edge.start_vertex().global_form().position(), ) .with_source((half_edge.clone(), half_edge.boundary()[0])); - let curve_approx = (half_edge.curve(), surface, range) + let curve_approx = ( + half_edge.curve(), + surface, + half_edge.global_form().curve().clone(), + range, + ) .approx_with_cache(tolerance, cache); HalfEdgeApprox {