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
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 % E-mail: david.legland@inrae.fr 0019 % Created: 2005-07-31 0020 % Copyright 2005-2024 INRA - TPV URPOI - BIA IMASTE 0021 0022 % equivalent to: 0023 % b = (xp-x0).*dy-(yp-y0).*dx < 0; 0024 b = bsxfun(@minus, ... 0025 bsxfun(@times, bsxfun(@minus, point(:,1), line(:,1)'), line(:,4)'), ... 0026 bsxfun(@times, bsxfun(@minus, point(:,2), line(:,2)'), line(:,3)')) < 0; 0027