Arc length for a spline

yakir12
Wed, 18 Mar 2020 21:31:08 +0000
General Usage

Given some spline (e.g. Dierckx.jl, Interpolations.jl), is there a good way to get its arc length?
Right now I’m using this:

using LinearAlgebra, Dierckx
t = range(0, stop = π, length = 100)
x = cos.(t)
y = sin.(t)
spl = ParametricSpline(t, hcat(x, y)')
tl = range(0, stop = π, length = 10000)
sum(norm(derivative(spl, i))*step(tl) for i in tl) # should be π

28 posts - 5 participants