Revision: 7183
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7183&view=rev
Author:   leejjoon
Date:     2009-06-05 23:45:53 +0000 (Fri, 05 Jun 2009)

Log Message:
-----------
axes_grid/clip_path.py : fix math domain error

Modified Paths:
--------------
    trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py

Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py    2009-06-05 
16:53:47 UTC (rev 7182)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py    2009-06-05 
23:45:53 UTC (rev 7183)
@@ -1,6 +1,12 @@
 import numpy as np
-from math import degrees, atan2
+from math import degrees
+import math
 
+def atan2(dy, dx):
+    if dx == 0 and dx == 0:
+        return 0
+    else:
+        return math.atan2(dy, dx)
 
 # FIXME : The current algorithm seems to return incorrect angle when the line
 # ends at the boudnary.
@@ -38,6 +44,10 @@
                 ns = -1
                 segx, segy = [], []
 
+                if dx == 0. and dy == 0:
+                    dx = x[+1] - x[i]
+                    dy = y[i+1] - y[i]
+
                 a = degrees(atan2(dy, dx))
                 _pos_angles.append((x0, y0, a))
 
@@ -48,6 +58,10 @@
                 segx, segy = [x0], [y0]
                 ns = i+1
 
+                if dx == 0. and dy == 0:
+                    dx = x[+1] - x[i]
+                    dy = y[i+1] - y[i]
+
                 a = degrees(atan2(dy, dx))
                 _pos_angles.append((x0, y0, a))
 


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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to