> hi, did you find this?
> http://matplotlib.sourceforge.net/faq/howto_faq.html?highlight=codex%20nxutils#test-whether-a-point-is-inside-a-polygon

I used the search function but no, i didn't find that link :) Shame on me and 
thank you Brent.

Looking at the implementation, it's really simple and i will do without 
matplotlib altogether and roll my own. In case anyone else needs this, the code 
is:

def insidePoly(x, y, xs, ys):
    """Decide whether point (x, y) lies inside the 2d polygon defined by its 
vertices zip(xs, ys).
    """
    result = False
    for now in xrange(len(xs)):
        if (ys[now] < y and ys[now - 1] >= y) or (ys[now - 1] < y and ys[now] 
>= y):
            if xs[now] + 1.0 * (y - ys[now]) * (xs[now - 1] - xs[now]) / 
(ys[now - 1] - ys[now]) < x:
                result = not result
    return result


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to