help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Geometry pointOnLine Fails


From: Thomas D. Dean
Subject: Geometry pointOnLine Fails
Date: Tue, 3 May 2016 15:12:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

I have a failure with pointOnLine, using the line and point option.

The document allows the arguments to be a line and a point or a line and a distance.

The function definition only seems to handle the line and distance option.

I think the definition should be something like

function point = pointOnLine(lin, pos)
  ang = lineAngle(lin);
  if  size(pos) == [1,2]
    point = [lin(:,1)+pos(1,1).*cos(ang), lin(:,2)+pos(1,2).*sin(ang)];
  elseif size(pos) == [1,1]
    point = [lin(:,1) + pos .* cos(ang), lin(:,2) + pos .* sin(ang)];
  else
    error('pointOnLine(line,d), arg d must be a point or a scalar');
  endif
endfunction;

Tom Dean



reply via email to

[Prev in Thread] Current Thread [Next in Thread]