From 05c6dddd803ef81923c641c35531de686afa8fd6 Mon Sep 17 00:00:00 2001 From: cgarling Date: Sun, 10 Aug 2025 23:12:01 -0400 Subject: [PATCH 1/3] Use `hypot` for `BSplineInterpolation`, `BSplineApprox` --- src/interpolation_caches.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/interpolation_caches.jl b/src/interpolation_caches.jl index 97ff494e..494cd7d7 100644 --- a/src/interpolation_caches.jl +++ b/src/interpolation_caches.jl @@ -824,7 +824,7 @@ function BSplineInterpolation( p[end] = one(eltype(t)) for i in 2:n - s += √((t[i] - t[i - 1])^2 + (u[i] - u[i - 1])^2) + s += hypot(t[i] - t[i - 1], u[i] - u[i - 1]) l[i - 1] = s end if pVecType == :Uniform @@ -1061,7 +1061,7 @@ function BSplineApprox( p[end] = one(eltype(t)) for i in 2:n - s += √((t[i] - t[i - 1])^2 + (u[i] - u[i - 1])^2) + s += hypot(t[i] - t[i - 1], u[i] - u[i - 1]) l[i - 1] = s end if pVecType == :Uniform From 193850b79356f67fe4cf4ad655f3145ebe1566e0 Mon Sep 17 00:00:00 2001 From: cgarling Date: Sun, 10 Aug 2025 23:12:18 -0400 Subject: [PATCH 2/3] Fix tests --- test/interpolation_tests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/interpolation_tests.jl b/test/interpolation_tests.jl index 3677da4f..37909fa5 100644 --- a/test/interpolation_tests.jl +++ b/test/interpolation_tests.jl @@ -799,8 +799,8 @@ end A = @inferred(BSplineInterpolation(u, t, 2, :ArcLen, :Average)) - @test [A(25.0), A(80.0)] == [13.363814458968486, 10.685201117692609] - @test [A(190.0), A(225.0)] == [13.437481084762863, 11.367034741256463] + @test [A(25.0), A(80.0)] == [13.363814458968484, 10.685201117692609] + @test [A(190.0), A(225.0)] == [13.437481084762863, 11.367034741256461] @test [A(t[1]), A(t[end])] == [u[1], u[end]] @test_throws ErrorException("BSplineInterpolation needs at least d + 1, i.e. 4 points.") BSplineInterpolation( From c10e0e534a319ce3f803f1d9f66d6aa2131a992f Mon Sep 17 00:00:00 2001 From: cgarling Date: Mon, 11 Aug 2025 08:44:14 -0400 Subject: [PATCH 3/3] Use `isapprox` in `BSplineInterpolation` tests --- test/interpolation_tests.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/interpolation_tests.jl b/test/interpolation_tests.jl index 37909fa5..0c7d20d5 100644 --- a/test/interpolation_tests.jl +++ b/test/interpolation_tests.jl @@ -799,9 +799,9 @@ end A = @inferred(BSplineInterpolation(u, t, 2, :ArcLen, :Average)) - @test [A(25.0), A(80.0)] == [13.363814458968484, 10.685201117692609] - @test [A(190.0), A(225.0)] == [13.437481084762863, 11.367034741256461] - @test [A(t[1]), A(t[end])] == [u[1], u[end]] + @test [A(25.0), A(80.0)] ≈ [13.363814458968484, 10.685201117692609] + @test [A(190.0), A(225.0)] ≈ [13.437481084762863, 11.367034741256461] + @test [A(t[1]), A(t[end])] ≈ [u[1], u[end]] @test_throws ErrorException("BSplineInterpolation needs at least d + 1, i.e. 4 points.") BSplineInterpolation( u[1:3], t[1:3], 3, :Uniform, :Uniform)