Mercurial > repos > public > sbplib
diff +parametrization/Curve.m @ 1094:ad3089f04e0b feature/dataspline
Revert changes in Curve so that spline() is not a static method.
author | Martin Almquist <malmquist@stanford.edu> |
---|---|
date | Fri, 05 Apr 2019 13:33:25 -0700 |
parents | 3c187e639dfa |
children | 36d092a00040 |
line wrap: on
line diff
--- a/+parametrization/Curve.m Fri Apr 05 13:15:45 2019 -0700 +++ b/+parametrization/Curve.m Fri Apr 05 13:33:25 2019 -0700 @@ -103,7 +103,7 @@ % Construct arcLength function using splines tvec = linspace(0,1,N); arcVec = obj.arcLength(0,tvec); - tFunc = parametrization.Curve.spline(arcVec,tvec); % t as a function of arcLength + tFunc = spline(arcVec,tvec); % t as a function of arcLength L = obj.arcLength(0,1); arcPar = @(s) tFunc(s*L); @@ -259,8 +259,8 @@ gVec = g(t)'; gpVec = (D1*gVec)'; - gp1_fun = parametrization.Curve.spline(t,gpVec(1,:)); - gp2_fun = parametrization.Curve.spline(t,gpVec(2,:)); + gp1_fun = spline(t,gpVec(1,:)); + gp2_fun = spline(t,gpVec(2,:)); gp_out = @(t) [gp1_fun(t);gp2_fun(t)]; end @@ -279,16 +279,6 @@ obj = parametrization.Curve(@g_fun, @g_fun_deriv); end - % Returns a function handle to the spline. - function f = spline(tval,fval,spline_order) - default_arg('spline_order',4); - [m,~] = size(tval); - assert(m==1,'Need row vectors.'); - - f_spline = spapi( optknt(tval,spline_order), tval, fval ); - f = @(t) fnval(f_spline,t); - end - function obj = circle(c,r,phi) default_arg('phi',[0; 2*pi]) default_arg('c',[0; 0]) @@ -392,3 +382,13 @@ end end end + +% Returns a function handle to the spline. +function f = spline(tval,fval,spline_order) + default_arg('spline_order',4); + [m,~] = size(tval); + assert(m==1,'Need row vectors.'); + + f_spline = spapi( optknt(tval,spline_order), tval, fval ); + f = @(t) fnval(f_spline,t); +end