Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Eric Firing
John Hunter wrote: > On Tue, Oct 14, 2008 at 2:58 PM, Eric Firing <[EMAIL PROTECTED]> wrote: >> mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions,PyArray_INT); >> >> in nxutils.cpp would become >> >> mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions, NPY_BOOL); >> >> Can anyone think of

Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread John Hunter
On Tue, Oct 14, 2008 at 2:58 PM, Eric Firing <[EMAIL PROTECTED]> wrote: > mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions,PyArray_INT); > > in nxutils.cpp would become > > mask = (PyArrayObject *)PyArray_SimpleNew(1,dimensions, NPY_BOOL); > > Can anyone think of anything this would break,

Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Eric Firing
Pierre GM wrote: > Mathew, > Have you tried the solution that was suggested by Angus yesterday on the > numpy > mailing list ? > > http://projects.scipy.org/pipermail/scipy-user/2008-February/015418.html > import numpy as np import matplotlib.nxutils as nxutils polygon=np.array([

Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Mathew Yeates
Angus originally suggest matplotlib. The other proposed solutions are overkill, unless it turns out that performance is a problem Thanks Mathew Pierre GM wrote: > Mathew, > Have you tried the solution that was suggested by Angus yesterday on the > numpy > mailing list ? > > http://projects.sci

Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Mathew Yeates
Thanks! Thats exactly what I was looking for! Mathew Michael Droettboom wrote: > If you can convert your polygon to a path, you can use the > "contains_point" method: > > >>> from matplotlib import path > >>> p = path.Path([[0,0], [42, 3], [45, 23], [1, 32]]) > >>> p.contains_point([5,5]) > 1 >

Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Pierre GM
Mathew, Have you tried the solution that was suggested by Angus yesterday on the numpy mailing list ? http://projects.scipy.org/pipermail/scipy-user/2008-February/015418.html >>> import numpy as np >>> import matplotlib.nxutils as nxutils >>> polygon=np.array([(0,0),(0,1),(1,1),(1,0)]) >>> point

Re: [Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Michael Droettboom
If you can convert your polygon to a path, you can use the "contains_point" method: >>> from matplotlib import path >>> p = path.Path([[0,0], [42, 3], [45, 23], [1, 32]]) >>> p.contains_point([5,5]) 1 >>> p.contains_point([72, 3]) 0 Mike Mathew Yeates wrote: > Is there a routine in matplotl

[Matplotlib-users] how to tell if a point is inside a polygon

2008-10-14 Thread Mathew Yeates
Is there a routine in matplotlib for telling whether a point is inside a convex 4 sided polygon? Mathew - This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applicat