Revision: 6078
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6078&view=rev
Author:   mdboom
Date:     2008-09-10 12:33:33 +0000 (Wed, 10 Sep 2008)

Log Message:
-----------
Add "filled" kwarg to path_intersects_path

Modified Paths:
--------------
    trunk/matplotlib/CHANGELOG
    trunk/matplotlib/lib/matplotlib/path.py
    trunk/matplotlib/src/_path.cpp

Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG  2008-09-09 23:15:59 UTC (rev 6077)
+++ trunk/matplotlib/CHANGELOG  2008-09-10 12:33:33 UTC (rev 6078)
@@ -1,7 +1,10 @@
+2008-09-10 Add "filled" kwarg to Path.intersects_path and
+           Path.intersects_bbox. - MGD
+
 2008-09-07 Changed full arrows slightly to avoid an xpdf rendering
            problem reported by Friedrich Hagedorn. - JKS
 
-2008-09-07 Fix conversion of quadratic to cubic Bezier curves in PDF 
+2008-09-07 Fix conversion of quadratic to cubic Bezier curves in PDF
            and PS backends. Patch by Jae-Joon Lee. - JKS
 
 2008-09-06 Added 5-point star marker to plot command - EF

Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py     2008-09-09 23:15:59 UTC (rev 
6077)
+++ trunk/matplotlib/lib/matplotlib/path.py     2008-09-10 12:33:33 UTC (rev 
6078)
@@ -242,21 +242,29 @@
             transform = transform.frozen()
         return Bbox(get_path_extents(self, transform))
 
-    def intersects_path(self, other):
+    def intersects_path(self, other, filled=True):
         """
         Returns *True* if this path intersects another given path.
+
+        *filled*, when True, treats the paths as if they were filled.
+         That is, if one path completely encloses the other,
+         :meth:`intersects_path` will return True.
         """
-        return path_intersects_path(self, other)
+        return path_intersects_path(self, other, filled)
 
-    def intersects_bbox(self, bbox):
+    def intersects_bbox(self, bbox, filled=True):
         """
         Returns *True* if this path intersects a given
         :class:`~matplotlib.transforms.Bbox`.
+
+        *filled*, when True, treats the path as if it was filled.
+        That is, if one path completely encloses the other,
+        :meth:`intersects_path` will return True.
         """
         from transforms import BboxTransformTo
         rectangle = self.unit_rectangle().transformed(
             BboxTransformTo(bbox))
-        result = self.intersects_path(rectangle)
+        result = self.intersects_path(rectangle, filled)
         return result
 
     def interpolated(self, steps):

Modified: trunk/matplotlib/src/_path.cpp
===================================================================
--- trunk/matplotlib/src/_path.cpp      2008-09-09 23:15:59 UTC (rev 6077)
+++ trunk/matplotlib/src/_path.cpp      2008-09-10 12:33:33 UTC (rev 6078)
@@ -1081,14 +1081,22 @@
 
 Py::Object _path_module::path_intersects_path(const Py::Tuple& args)
 {
-    args.verify_length(2);
+    args.verify_length(2, 3);
 
     PathIterator p1(args[0]);
     PathIterator p2(args[1]);
+    bool filled = false;
+    if (args.size() == 3) {
+      filled = args[2].isTrue();
+    }
 
-    return Py::Int(::path_intersects_path(p1, p2)
-                   || ::path_in_path(p1, agg::trans_affine(), p2, 
agg::trans_affine())
-                   || ::path_in_path(p2, agg::trans_affine(), p1, 
agg::trans_affine()));
+    if (!filled) {
+      return Py::Int(::path_intersects_path(p1, p2));
+    } else {
+      return Py::Int(::path_intersects_path(p1, p2)
+        || ::path_in_path(p1, agg::trans_affine(), p2, agg::trans_affine())
+        || ::path_in_path(p2, agg::trans_affine(), p1, agg::trans_affine()));
+    }
 }
 
 void _add_polygon(Py::List& polygons, const std::vector<double>& polygon) {


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
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to