Skip to content

Commit

Permalink
geom2d/clipRay.m: fix bug for multiple rays
Browse files Browse the repository at this point in the history
  • Loading branch information
dlegland committed Jun 8, 2020
1 parent 027467b commit 3e05496
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions matGeom/geom2d/clipRay.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

% ------
% Author: David Legland
% e-mail: david.legland@inra.fr
% e-mail: david.legland@inrae.fr
% Created: 2010-05-13, using Matlab 7.4.0.287 (R2007a)
% Copyright 2010 INRA - Cepia Software Platform.

Expand All @@ -44,8 +44,8 @@
inds = find(isfinite(edge(:, 1)));

% compute position of edge extremities relative to the ray
pos1 = linePosition(edge(inds,1:2), ray(inds,:));
pos2 = linePosition(edge(inds,3:4), ray(inds,:));
pos1 = linePosition(edge(inds,1:2), ray(inds,:), 'diag');
pos2 = linePosition(edge(inds,3:4), ray(inds,:), 'diag');

% if first point is before ray origin, replace by origin
edge(inds(pos1 < 0), 1:2) = ray(inds(pos1 < 0), 1:2);
Expand Down

0 comments on commit 3e05496

Please sign in to comment.