Adrien definitely has the right idea : determine the parametric coordinate, then perform linear interpolation along the x and y coordinates separately.
One thing I would like to add is another way to determine your parametric coordinate so that you can create evenly distributed interpolation points across the entire shape in one pass. The first thing you want to do if you have not done so already is to make sure that the last coordinate point is reconnected to the first, replicating the first point and adding it to the end:
B = [B; B(1,:)];
Then, calculating the total distance between subsequent points, then taking the cumulative sum, you can get a parametric coordinate that takes small steps for points close to each other and larger steps for points remote from each other:
distance = sqrt(sum(diff(B,1,1).^2,2)); %
Now you can interpolate a new set of points that are evenly distributed along the edge along the straight lines connecting your points using the INTERP1Q function:
sNew = linspace(0,s(end),100).'; %'# 100 evenly spaced points from 0 to s(end) xNew = interp1q(s,B(:,1),sNew); %# Interpolate new x values yNew = interp1q(s,B(:,2),sNew); %# Interpolate new y values
These new point sets will not necessarily include starting points, so if you want to make sure that the starting points also appear in the new set, you can do the following:
[sAll,sortIndex] = sort([s; sNew]); %
Example:
Here is an example showing how this code is executed (I use 11 pairs of x and y coordinates, one of which is repeated for a complete example):
B = [0.1371 0.1301; ... %
