image thumbnail
[Flag]=inout(X,Y,Line)
function [Flag]=inout(X,Y,Line)
%
% [Flag]=inout(X,Y,Line)
% ~~~~~~~~~~~~~~~~~~~~~~
% Determine if a point is above or below/on
% a line.  
%
% X,Y  - point to consider
% Line - vector containing coefficients
%        of line equation in form
%        Line(1)+Line(2)*X+Line(3)*Y=0
%
% Flag - =0, point above line
%        =1, point below/on line
%
% NOTE:  The theorem for determining whether
%        a point is above or below a line
%        assumes that Line(3)>0. By
%        reversing the signs of all the 
%        coefficients of the line equation
%        the above/below sense is reversed.
%        (This is used advantageously in the
%        kern program.)
%
% User m functions called:  none
%----------------------------------------------

Flag=0;
Product=Line(2)*X+Line(3)*Y+Line(1);
if Product <= 0, Flag=1; end;

Contact us at files@mathworks.com