Michael Droettboom wrote:
I just added a test of intersects_bbox to SVN that seems to be working correctly for short paths containing masked values. It would appear that masked values *should* be dealt with correctly (that is, in exactly the same way as they are drawn) by the intersection code. However, there is probably a side case here that I'm missing. As Eric suggests, see if you can break it down into a simple example that fails and hopefully the problem and/or solution will be more obvious from that.

Mike,

I was wrong; it has nothing to do with masked values. It is much simpler: it appears that for the purpose of this test, the path is being treated as if it were closed. See attached. I think this accounts for Evan's mis-identified tracks.

Eric

from pylab import *
import numpy as np
from matplotlib.transforms import Bbox
from matplotlib.path import Path
from matplotlib.patches import Rectangle

rect = Rectangle((-1, -1), 2, 2, facecolor="#aaaaaa")
gca().add_patch(rect)
bbox = Bbox.from_bounds(-1, -1, 2, 2)

vertices = np.array([(-2, -2), (2, -2), (2, 2), (-2, 2)])
path = Path(vertices)
if path.intersects_bbox(bbox):
    color = 'r'
else:
    color = 'b'
plot(vertices[:,0], vertices[:,1], color=color)
axis([-3, 3, -3, 3])
show()
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to