Assuming del is a column vector of the same size as t and is the desired change in x, try this
xy1 = [141.64 399.53];
xy2 = [213.32 250.96];
t = linspace(0,1,11)';
del = [0 1 2 0 0 1 0 0 0 1.5 0]';
m = (xy1(2)-xy2(2))/(xy1(1)-xy2(1));
xOld = (1-t)*xy1(1) + t*xy2(1);
ind = del~=0;
x = unique(sort([xOld; xOld(ind)+del(ind); xOld(ind)-del(ind)]));
y = m*(x-xy1(1))+xy1(2);
plot(x,y,'b-o')
If del is the desired distance (2 norm) between the original point and one of the new points, try this
xy1 = [141.64 399.53];
xy2 = [213.32 250.96];
t = linspace(0,1,11)';
xyOld = (1-t)*xy1 + t*xy2;
del = [0 1 2 0 0 1 0 0 0 1.5 0]';
m = (xy1(2)-xy2(2))/(xy1(1)-xy2(1));
theta = atan(m);
ind = del~=0;
xy = unique( [xyOld; ...
xyOld(ind,:) + [del(ind)*cos(theta),del(ind)*sin(theta)]; ...
xyOld(ind,:) - [del(ind)*cos(theta),del(ind)*sin(theta)] ], 'rows' );
plot(xy(:,1),xy(:,2),'b-o')
Best Answer