Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit9f6370c

Browse files
scottshambaughmeeseeksmachine
authored andcommitted
Backport PR#29285: Retarget PR#29175 to main
1 parentb4e60b6 commit9f6370c

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

‎lib/mpl_toolkits/mplot3d/art3d.py

Lines 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
forpoly_i,psinenumerate(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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
importmatplotlib.pyplotasplt
44

55
frommatplotlib.backend_basesimportMouseEvent
6-
frommpl_toolkits.mplot3d.art3dimportLine3DCollection,_all_points_on_plane
6+
frommpl_toolkits.mplot3d.art3dimport (
7+
Line3DCollection,
8+
Poly3DCollection,
9+
_all_points_on_plane,
10+
)
711

812

913
deftest_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+
deftest_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)

[8]ページ先頭

©2009-2025 Movatter.jp