Home > matGeom > geom2d > isLeftOriented.m

isLeftOriented

PURPOSE ^

ISLEFTORIENTED Test if a point is on the left side of a line.

SYNOPSIS ^

function b = isLeftOriented(point, line)

DESCRIPTION ^

ISLEFTORIENTED Test if a point is on the left side of a line.

   B = isLeftOriented(POINT, LINE);
   Returns TRUE if the point lies on the left side of the line with
   respect to the line direction.
   
   If POINT is a NP-by-2 array, and/or LINE is a NL-by-4 array, the result
   is a NP-by-NL array containing the result for each point-line
   combination.

   See also:
   lines2d, points2d, isCounterClockwise, isPointOnLine, distancePointLine

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function b = isLeftOriented(point, line)
0002 %ISLEFTORIENTED Test if a point is on the left side of a line.
0003 %
0004 %   B = isLeftOriented(POINT, LINE);
0005 %   Returns TRUE if the point lies on the left side of the line with
0006 %   respect to the line direction.
0007 %
0008 %   If POINT is a NP-by-2 array, and/or LINE is a NL-by-4 array, the result
0009 %   is a NP-by-NL array containing the result for each point-line
0010 %   combination.
0011 %
0012 %   See also:
0013 %   lines2d, points2d, isCounterClockwise, isPointOnLine, distancePointLine
0014 %
0015 
0016 %   ---------
0017 %   author : David Legland
0018 %   INRA - TPV URPOI - BIA IMASTE
0019 %   created the 31/07/2005.
0020 
0021 %   HISTORY
0022 %   2017-09-04 uses bsxfun
0023 
0024 % equivalent to:
0025 % b = (xp-x0).*dy-(yp-y0).*dx < 0;
0026 b = bsxfun(@minus, ...
0027     bsxfun(@times, bsxfun(@minus, point(:,1), line(:,1)'), line(:,4)'), ...
0028     bsxfun(@times, bsxfun(@minus, point(:,2), line(:,2)'), line(:,3)')) < 0;
0029

Generated on Wed 16-Feb-2022 15:10:47 by m2html © 2003-2019