function p = closed_spline_curve(c,tau,n,t)
% CLOSED_SPLINE_CURVE: evaluation of a closed spline curve
% p = closed_spline_curve(c,tau,n,t)
% points p(j,:) for parameters t(j) of a closed spline curve of degree n
% with control points c(0:M-1,:) and knots tau(0:M)
% change to column vectors (if necessary)
tau = tau(:); t = t(:);
% convert to open curve
T = tau(end)-tau(1);
for k = 1:n
c = [c(end+1-k,:); c];
tau = [tau(end+1-2*k)-T; tau; tau(2*k)+T];
end
% evaluate with respect to each coordinate
for k = 1:size(c,2);
p(:,k) = spline_evaluation(c(:,k),tau,t);
end