function varargout = inpolygon(varargin)
%INPOLYGON True for points inside or on a polygonal region.
%   IN = INPOLYGON(X,Y,XV,YV)
%   [IN ON] = INPOLYGON(X,Y,XV,YV)
%   
%   Example:
%    
%       xv = [0 3 3 0 0 NaN 1 1 2 2 1];
%       yv = [0 0 3 3 0 NaN 1 2 2 1 1];
%       x = rand(1000,1,'gpuArray')*3; 
%       y = rand(1000,1,'gpuArray')*3;
%       in = inpolygon(x,y,xv,yv);
%       plot(xv,yv,x(in),y(in),'.r',x(~in),y(~in),'.b')
%   
%   See also INPOLYGON, GPUARRAY, GPUARRAY/RAND.


%   Copyright 2014 The MathWorks, Inc.

% try...catch prevents error being reported by internal
try
    [varargout{1:nargout}] = parallel.internal.flowthrough.inpolygon(varargin{:});
catch ME
    throw(ME);
end
