| |
| | [No title] (Site not responding. Last check: 2007-11-01) |
 | | function isin = isinpoly(x,y,xp,yp) % ISIN = ISINPOLY(X,Y,XP,YP) Finds whether points with % coordinates X and Y are inside or outside of % a polygon with vertices XP, YP. |
 | | % Returns matrix ISIN of the same size as X and Y % with 0 for points outside a polygon, 1 for % inside points and 0.5 for points belonging % to a polygon XP, YP itself. |
 | | 1)); isin = any(A==1)-any(A==-1); isin = (abs(sum(A))-isin)/2; % Check for boundary points A = (yp(:,e)==y(:,ep)')&(xp(:,e)==x(:,ep)'); fnd = find(any(A)); isin(fnd) =.5*ones(size(fnd)); isin = round(isin*2)/2; % Reshape output to the input size isin = reshape(isin,sz(1),sz(2)); |
| www.nbb.cornell.edu /neurobio/jbsv_downloads/homerange/isinpoly.m (112 words) |
|