help-octave
[Top][All Lists]
Advanced

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

Re: ParallelLine


From: Juan Pablo Carbajal
Subject: Re: ParallelLine
Date: Wed, 4 May 2016 11:48:00 +0200

On Wed, May 4, 2016 at 4:25 AM, Thomas D. Dean <address@hidden> wrote:
> Hi Juan,
>
> My earlier problem was with parallelLine, not pointOnLine.
>
> octave:9> parallelLine([1 1 1 1],[1 1])
> error: parallelLine: A(I) = X: X must have the same size as I
> error: called from
>     parallelLine at line 52 column 12
>
> The doc string is
>
>  -- Function File: RES = parallelLine (LINE, POINT)
>  -- Function File: RES = parallelLine (LINE, DIST)
>      Create a line parallel to another one.
>
>      Returns the line with same direction vector than LINE and going
>      through the point given by POINT. LINE is given as [x0 y0 dx dy]
>      and POINT is [xp yp].
>
>      Uses relative distance to specify position.  The new line will be
>      located at distance DIST, counted positive in the right side of
>      LINE and negative in the left side.
>
> Tom Dean

Hi Tom,

Please keep the discussion in ht emailing list

Indeed, geometry is lagging behind upstream matgeom, but i am working
on that. This bug was fixed not long ago. Replace parallelLine with
this code

function res = parallelLine(line, point)

  if size (point, 2) == 1
      # use a distance. Compute position of point located at distance DIST on
      # the line orthogonal to the first one.
      point = pointOnLine([line(:,1) line(:,2) line(:,4) -line(:,3)], point);
  end

  # normal case: compute line through a point with given direction
  res         = zeros (size (line, 1), 4);
  res(:, 1:2) = point;
  res(:, 3:4) = line(:, 3:4);

endfunction

This will be fixed in the next release of geometry.



reply via email to

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