I've the following to divide a line to equal segments ref
xy1 = [141.64 399.53];xy2 = [213.32 250.96];t = linspace(0,1,11)';xy = (1-t)*xy1 + t*xy2;plot(xy(:,1),xy(:,2),'b-o') Output:xy = 141.6400 399.5300 148.8080 384.6730 155.9760 369.8160 163.1440 354.9590 170.3120 340.1020 177.4800 325.2450 184.6480 310.3880 191.8160 295.5310 198.9840 280.6740 206.1520 265.8170 213.3200 250.9600
I'd like to do the following for positioning new points along the line between points xy1 and xy2.
xy del 141.6400 399.5300 0 148.8080 384.6730 1 155.9760 369.8160 2 163.1440 354.9590 0 170.3120 340.1020 0 177.4800 325.2450 1 184.6480 310.3880 0 191.8160 295.5310 0 198.9840 280.6740 0 206.1520 265.8170 1.5 213.3200 250.9600 0
when shift is 0 , no point has to be added in the neighborhood of the corresponding (x,y).
For any nonzero value, 2 points (one to right and one to left) have to be added.
For example if xy = (10,0)
del=2 would mean 2 points (8,0) and (12,0) have to be generated in the code for adding the new points on line between points xy1 and xy2.
del=1 would mean 2 points (9,0) and (11,0) have to be generated in the code for adding the new points on line between points xy1 and xy2.
Any suggestions on how to do this will be of great help!
Best Answer