Mercurial > octave
diff scripts/geometry/inpolygon.m @ 7125:f084ba47812b
[project @ 2007-11-08 02:29:23 by jwe]
author | jwe |
---|---|
date | Thu, 08 Nov 2007 02:29:24 +0000 |
parents | a1dbe9d80eee |
children | eb7bdde776f2 |
line wrap: on
line diff
--- a/scripts/geometry/inpolygon.m Thu Nov 08 01:09:44 2007 +0000 +++ b/scripts/geometry/inpolygon.m Thu Nov 08 02:29:24 2007 +0000 @@ -38,15 +38,19 @@ function [IN, ON] = inpolygon (X, Y, xv, yv) - if ( !(isreal(X) && isreal(Y) && ismatrix(Y) && ... - ismatrix(Y) && size_equal(X,Y)) ) + if (nargin != 4) + print_usage (); + endif + + if (! (isreal (X) && isreal (Y) && ismatrix (Y) && ismatrix (Y) + && size_equal (X, Y))) error ("inpolygon: first two arguments must be real matrices of same size"); - elseif ( !(isreal(xv) && isreal(yv) && isvector(xv) && ... - isvector(yv) && size_equal(xv,yv)) ) + elseif (! (isreal (xv) && isreal (yv) && isvector (xv) && isvector (yv) + && size_equal (xv, yv))) error ("inpolygon: last two arguments must be real vectors of same size"); endif - npol = length(xv); + npol = length (xv); do_boundary = (nargout >= 2); IN = zeros (size(X), "logical"); @@ -76,6 +80,7 @@ endif j = i; endfor + endfunction %!demo