Hello,

I tested the following code on my Mac laptop and our production Linux server 
both running matplotlib V1.0.1. Both machines observe the same output from the 
code, so I was wondering if somebody is aware of the problem or if it's some 
undocumented feature of "pnpoly()" function from matplotlib.nxutils?

I use matplotlib.nxutils.pnpoly() function from matplotlib to determine if 
point belongs to the polygon. 
The following code:

>>> import numpy as np
>>> import matplotlib.nxutils as nx
>>> coords = np.array([[4.0, 1.0], [4.0, 4.0], [5.0, 5.0], [6.0, 4.0], [5.0, 
>>> 0.0]])

>>> nx.pnpoly(4.0, 1.0, coords)
1
>>> nx.pnpoly(4.0, 4.0, coords)
1
>>> nx.pnpoly(5.0, 5.0, coords)
0
>>> nx.pnpoly(6.0, 4.0, coords)
0
>>> nx.pnpoly(5.0, 0.0, coords)
0

The question is why first two vertexes are considered to be inside of defined 
polygon, and last 3 vertexes are not? My guess, it's treating the polygon as a 
semi-open set, and I wonder if it can be changed to make all vertexes inclusive?

Any help would be greatly appreciated.

Many thanks,
Masha
--------------------
liu...@usc.edu




------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to