I want to create a line between two points start:(x1,y1) and end:(x2,y2) where the coordinates x1,y1,x2,y2 are sampled randomly from uniform distribution. Then I want to create another line with the same starting point and same orientation but unit length. My approach: I use "rand" function in matlab to get the coordinates. The orientation using dy/dx. I do not know how do I fix the orientation of the second line as dy/dx.
MATLAB: Creating lines of a random orientation and unit length in matlab
lineunit vector
Best Answer