How can I divide a line segment into equidistant parts in Matlab?

65 Views Asked by At

I have two parallel line segments of different lengths. I have the endpoints of each line segment.

I want to have equidistant points on both line segments and then join the corresponding points on both line segments with a set of lines.

1

There are 1 best solutions below

1
On BEST ANSWER

If your line goes from $(x_1,y_1)$ to $(x_2,y_2)$, then $n$ equidistant points on the line are given by

$$\frac i{n-1}(x_1,y_1) + \left(1-\frac i{n-1}\right)(x_2,y_2), \qquad \text{for $i=0,...,n-1$}.$$