Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4eeba2a

Browse filesBrowse files
Merge pull request #29285 from scottshambaugh/gh_29156
2 parents 8d8751d + e5f5765 commit 4eeba2a
Copy full SHA for 4eeba2a

File tree

2 files changed

+17
-1
lines changed
Filter options

2 files changed

+17
-1
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/art3d.py
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,6 +1382,7 @@ def _generate_normals(polygons):
13821382
v2 = np.empty((len(polygons), 3))
13831383
for poly_i, ps in enumerate(polygons):
13841384
n = len(ps)
1385+
ps = np.asarray(ps)
13851386
i1, i2, i3 = 0, n//3, 2*n//3
13861387
v1[poly_i, :] = ps[i1, :] - ps[i2, :]
13871388
v2[poly_i, :] = ps[i2, :] - ps[i3, :]

‎lib/mpl_toolkits/mplot3d/tests/test_art3d.py

Copy file name to clipboardExpand all lines: lib/mpl_toolkits/mplot3d/tests/test_art3d.py
+16-1Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
import matplotlib.pyplot as plt
44

55
from matplotlib.backend_bases import MouseEvent
6-
from mpl_toolkits.mplot3d.art3d import Line3DCollection, _all_points_on_plane
6+
from mpl_toolkits.mplot3d.art3d import (
7+
Line3DCollection,
8+
Poly3DCollection,
9+
_all_points_on_plane,
10+
)
711

812

913
def test_scatter_3d_projection_conservation():
@@ -85,3 +89,14 @@ def test_all_points_on_plane():
8589
# All points lie on a plane
8690
points = np.array([[0, 0, 0], [0, 1, 0], [1, 0, 0], [1, 1, 0], [1, 2, 0]])
8791
assert _all_points_on_plane(*points.T)
92+
93+
94+
def test_generate_normals():
95+
# Smoke test for https://github.com/matplotlib/matplotlib/issues/29156
96+
vertices = ((0, 0, 0), (0, 5, 0), (5, 5, 0), (5, 0, 0))
97+
shape = Poly3DCollection([vertices], edgecolors='r', shade=True)
98+
99+
fig = plt.figure()
100+
ax = fig.add_subplot(projection='3d')
101+
ax.add_collection3d(shape)
102+
plt.draw()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.