function r = nurbs(c,w,tau,t) 
% NURBS: evaluation of a rational spline curve
% r = nurbs(c,w,tau,t)  
% points r(j) for parameters t(j) of a rational spline curve 
% with control points c(k,:), weights w, and knots tau

% convert to homogeneous coordinates
dim = size(c,2);
cw = [c.*repmat(w(:),1,dim), w(:)];

% evaluate 
pq = spline_curve(cw,tau,t);

% divide by denominator
r = pq(:,1:dim) ./ repmat(pq(:,dim+1),1,dim);
  
