Revision: 6712
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6712&view=rev
Author:   mdboom
Date:     2008-12-29 14:42:20 +0000 (Mon, 29 Dec 2008)

Log Message:
-----------
Fix path simplification by a) making it more conservative about when it will 
simplify based on segment length, and b) honoring path.simplify rcParam in Agg 
backend.

Modified Paths:
--------------
    trunk/matplotlib/lib/matplotlib/config/rcsetup.py
    trunk/matplotlib/lib/matplotlib/path.py
    trunk/matplotlib/lib/matplotlib/rcsetup.py
    trunk/matplotlib/src/agg_py_path_iterator.h

Modified: trunk/matplotlib/lib/matplotlib/config/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/config/rcsetup.py   2008-12-29 14:25:47 UTC 
(rev 6711)
+++ trunk/matplotlib/lib/matplotlib/config/rcsetup.py   2008-12-29 14:42:20 UTC 
(rev 6712)
@@ -479,7 +479,7 @@
     'svg.embed_char_paths' : [True, validate_bool],  # True to save all 
characters as paths in the SVG
     'plugins.directory' : ['.matplotlib_plugins', str], # where plugin 
directory is locate
 
-    'path.simplify' : [False, validate_bool]
+    'path.simplify' : [True, validate_bool]
 }
 
 if __name__ == '__main__':

Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py     2008-12-29 14:25:47 UTC (rev 
6711)
+++ trunk/matplotlib/lib/matplotlib/path.py     2008-12-29 14:42:20 UTC (rev 
6712)
@@ -109,8 +109,9 @@
         assert vertices.ndim == 2
         assert vertices.shape[1] == 2
 
-        self.should_simplify = (len(vertices) >= 128 and
-                                (codes is None or np.all(codes <= 
Path.LINETO)))
+        self.should_simplify = (rcParam['path.simplify'] and
+                                (len(vertices) >= 128 and
+                                (codes is None or np.all(codes <= 
Path.LINETO))))
         self.has_nonfinite = not np.isfinite(vertices).all()
         self.codes = codes
         self.vertices = vertices

Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py  2008-12-29 14:25:47 UTC (rev 
6711)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py  2008-12-29 14:42:20 UTC (rev 
6712)
@@ -518,7 +518,7 @@
     'docstring.hardcopy' : [False, validate_bool],  # set this when you want 
to generate hardcopy docstring
     'plugins.directory' : ['.matplotlib_plugins', str], # where plugin 
directory is locate
 
-    'path.simplify' : [False, validate_bool],
+    'path.simplify' : [True, validate_bool],
     'agg.path.chunksize' : [0, validate_int]       # 0 to disable chunking;
                                                    # recommend about 20000 to
                                                    # enable. Experimental.

Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h 2008-12-29 14:25:47 UTC (rev 
6711)
+++ trunk/matplotlib/src/agg_py_path_iterator.h 2008-12-29 14:42:20 UTC (rev 
6712)
@@ -353,7 +353,7 @@
 
             //if the perp vector is less than some number of (squared)
             //pixels in size, then merge the current vector
-            if (perpdNorm2 < 0.25)
+            if (perpdNorm2 < (1.0 / 9.0))
             {
                 //check if the current vector is parallel or
                 //anti-parallel to the orig vector. If it is parallel, test


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to