Revision: 6076 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6076&view=rev Author: mdboom Date: 2008-09-09 12:58:33 +0000 (Tue, 09 Sep 2008)
Log Message: ----------- Add unit test for Path.intersects_bbox. Modified Paths: -------------- trunk/matplotlib/examples/tests/backend_driver.py Added Paths: ----------- trunk/matplotlib/examples/api/bbox_intersect.py Added: trunk/matplotlib/examples/api/bbox_intersect.py =================================================================== --- trunk/matplotlib/examples/api/bbox_intersect.py (rev 0) +++ trunk/matplotlib/examples/api/bbox_intersect.py 2008-09-09 12:58:33 UTC (rev 6076) @@ -0,0 +1,21 @@ +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) + +for i in range(12): + vertices = (np.random.random((4, 2)) - 0.5) * 6.0 + vertices = np.ma.masked_array(vertices, [[False, False], [True, True], [False, False], [False, False]]) + path = Path(vertices) + if path.intersects_bbox(bbox): + color = 'r' + else: + color = 'b' + plot(vertices[:,0], vertices[:,1], color=color) + +show() Modified: trunk/matplotlib/examples/tests/backend_driver.py =================================================================== --- trunk/matplotlib/examples/tests/backend_driver.py 2008-09-09 12:33:03 UTC (rev 6075) +++ trunk/matplotlib/examples/tests/backend_driver.py 2008-09-09 12:58:33 UTC (rev 6076) @@ -124,6 +124,7 @@ api_dir = os.path.join('..', 'api') api_files = [ + 'bbox_intersect.py', 'colorbar_only.py', 'color_cycle.py', 'donut_demo.py', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- 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-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins