I have found a workaround for this which works for my particular application. I have basically used the polyfit function:
load('waypointsData.mat')
px = polyfit(cumLengthWP,waypointsOriginal(:,1),3); % using 3rd order polynomial
py = polyfit(cumLengthWP,waypointsOriginal(:,2),3); % using 3rd order polynomial
for i = 1:length(cumLength)
waypoints_resampled(i,1) = px(1)*cumLength(i)^3 + px(2)*cumLength(i)^2 + px(3)*cumLength(i) + px(4); % x2
waypoints_resampled(i,2) = py(1)*cumLength(i)^3 + py(2)*cumLength(i)^2 + py(3)*cumLength(i) + py(4); % y2
end
plot(waypoints_resampled(:,1),waypoints_resampled(:,2),'r',waypointsOriginal(:,1),waypointsOriginal(:,2),'b--')
legend('Resampled','Original')
I definitely look forward to hearing more efficient way(s). Thanks again!