function st = spl_val(s,t) % SPL_VAL : evaluation of splines % st = spl_val(s,t) % points p(j,:) on a spline s % with control points s.c(k,:) and knots s.tau(k) % at t(j) [lc,dim] = size(s.c); n = length(s.tau) - lc - 1; c = [zeros(n+1,dim); s.c; zeros(n+1,dim)]; tmax = repmat(2*norm([s.tau; t],inf),n+1,1); tau = [-tmax; s.tau; tmax]; for j = 1:length(t) kj = find(tau(1:end-1) <= t(j) & ... tau(2:end) > t(j)); stj = c(kj-n:kj,:); for m = 1:n ind = [kj-n+m:kj]; gamma = repmat(((t(j) - tau(ind)) ./ ... (tau(ind+n+1-m) - tau(ind))),1,dim); stj = gamma .* stj(2:end,:) + ... (1-gamma) .* stj(1:end-1,:); end st(j,:) = stj; end