On 26-Jun-08, at 11:37 PM, David Goldsmith wrote:

> Hi!  Does matplotlib have already implemented a method to return  
> true/false according as a provided point is inside a provided  
> polygon?  Thanks!

In [15]: help matplotlib.nxutils
-------> help(matplotlib.nxutils)
Help on module matplotlib.nxutils in matplotlib:

NAME
     matplotlib.nxutils - general purpose utilities (numpy).

FILE
     /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/ 
site-package
s/matplotlib/nxutils.so

FUNCTIONS
     pnpoly(...)
         inside = pnpoly(x, y, xyverts)
         return 1 if x,y is inside the polygon defined by the sequence  
of x,y ver
tices in xyverts

     points_inside_poly(...)
         mask = points_inside_poly(xypoints, xyverts)
         return a mask of length xypoints indicating whether each x,y  
point is in
side the polygon defined by the sequence of x,y vertices in xyverts

If you're interested in the algorithm:
        
http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html


Regards,

David

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to