POINTONLINE Create a point on a line at a given position on the line. P = pointOnLine(LINE, POS); Creates the point belonging to the line LINE, and located at the distance D from the line origin. LINE has the form [x0 y0 dx dy]. LINE and D should have the same number N of rows. The result will have N rows ans 2 column (x and y positions). See also: lines2d, points2d, onLine, onLine, linePosition --------- author : David Legland INRA - TPV URPOI - BIA IMASTE created the 07/04/2004.
0001 function point = pointOnLine(line, pos) 0002 %POINTONLINE Create a point on a line at a given position on the line. 0003 % 0004 % P = pointOnLine(LINE, POS); 0005 % Creates the point belonging to the line LINE, and located at the 0006 % distance D from the line origin. 0007 % LINE has the form [x0 y0 dx dy]. 0008 % LINE and D should have the same number N of rows. The result will have 0009 % N rows ans 2 column (x and y positions). 0010 % 0011 % See also: 0012 % lines2d, points2d, onLine, onLine, linePosition 0013 % 0014 % --------- 0015 % 0016 % author : David Legland 0017 % INRA - TPV URPOI - BIA IMASTE 0018 % created the 07/04/2004. 0019 % 0020 0021 0022 angle = lineAngle(line); 0023 point = [line(:,1) + pos .* cos(angle), line(:,2) + pos .* sin(angle)]; 0024