Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1296ee9

Browse files
committed
Add RuntimeWarning guard.
1 parent 7aed240 commit 1296ee9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/mpl_toolkits/mplot3d/proj3d.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def _line2d_seg_dist(p1, p2, p0):
2222
x01 = np.asarray(p0[0]) - p1[0]
2323
y01 = np.asarray(p0[1]) - p1[1]
2424

25-
u = (x01*x21 + y01*y21) / (x21**2 + y21**2)
25+
with np.errstate(divide='ignore'):
26+
u = (x01*x21 + y01*y21) / (x21**2 + y21**2)
2627
u = np.clip(u, 0, 1)
2728
d = np.hypot(x01 - u*x21, y01 - u*y21)
2829

0 commit comments

Comments
 (0)