Mathematica BSplineCurve in Julia

@arnief3
If the knot vector k is defined like this, then we don’t need the scaling t->M(t*max_k).

using StaticArrays
using BasicBSpline

function bsplcurve(p, pts)
    @assert length(pts) > p
    k = KnotVector(range(0,1,length(pts)-p+1))+p*KnotVector(0,1)
    P = BSplineSpace{p}(k)
    M = BSplineManifold(pts, (P,))
    return M
end

pts = [SVector(0, 0), SVector(1, 1), SVector(2, -1), SVector(3, 0), SVector(4, -2), SVector(5, 1)]
p = 2

bspl = bsplcurve(p, pts)
bspl_pts = [bspl(i) for i = range(0, 1, 100)]
1 Like