Home > FMAToolbox > Plot > UIInPolygon.m

UIInPolygon

PURPOSE ^

UIInPolygon - Find points in interactively defined polygon zone.

SYNOPSIS ^

function in = UIInPolygon(X,Y)

DESCRIPTION ^

UIInPolygon - Find points in interactively defined polygon zone.

  Mouse buttons:
   left    =   add polygon point
   right   =   remove last polygon point
   middle  =   close polygon

  USAGE

    in = UIInPolygon(X,Y)

    X,Y            polygon coordinates
    in             logical vector indicating whether points at (X,Y) are inside

  SEE

    See also UISelect

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function in = UIInPolygon(X,Y)
0002 
0003 %UIInPolygon - Find points in interactively defined polygon zone.
0004 %
0005 %  Mouse buttons:
0006 %   left    =   add polygon point
0007 %   right   =   remove last polygon point
0008 %   middle  =   close polygon
0009 %
0010 %  USAGE
0011 %
0012 %    in = UIInPolygon(X,Y)
0013 %
0014 %    X,Y            polygon coordinates
0015 %    in             logical vector indicating whether points at (X,Y) are inside
0016 %
0017 %  SEE
0018 %
0019 %    See also UISelect
0020 %
0021 
0022 % Copyright (C) 2009-2011 by Michaƫl Zugaro
0023 %
0024 % This program is free software; you can redistribute it and/or modify
0025 % it under the terms of the GNU General Public License as published by
0026 % the Free Software Foundation; either version 3 of the License, or
0027 % (at your option) any later version.
0028 
0029 [Xp,Yp,p] = UISelect;
0030 in = inpolygon(X,Y,Xp,Yp);
0031 hold on;
0032 pts = plot(X(in),Y(in),'+r');
0033 hold off;
0034 pause(0.4);
0035 delete(p);
0036 delete(pts);

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005