[SciPy-user] efficient "inside polygon" test for an array??

Robert Kern robert.kern@gmail....
Mon Feb 4 13:12:38 CST 2008


David Warde-Farley wrote:
> On 4-Feb-08, at 11:15 AM, John Hunter wrote:
> 
>> On Feb 4, 2008 9:56 AM, Eric Emsellem <emsellem@obs.univ-lyon1.fr>  
>> wrote:
>>> Hi
>>>
>>> I have a polygon (defined by 4 vertices) and I wish to have an  
>>> efficient way of
>>> selecting the points which are inside this polygon.
>>> So I would like something like:
>>>
>>> selection = pointsInPolygon(x,y,poly)
> 
> It seems your problem has already been addressed, but some very good  
> discussion of this problem (along with some 30-odd year old code, and  
> a more recent C implementation) can be found at
> 
> http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html
> 
> I wouldn't be surprised if nxutils uses the same algorithm.

It does.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


More information about the SciPy-user mailing list