python 画空间多边形
import mpl_toolkits.mplot3d as a3
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import numpy as np
ax = a3.Axes3D(plt.figure())
A=[[[0,0,0],[1,1,0],[1,0,1]],[[0,0,0],[1,1,0],[0.5,1,0.5],[0,0.5,0.5],]]
for p0 in A:
tri = a3.art3d.Poly3DCollection([p0])
tri.set_color(colors.rgb2hex(np.random.rand(3)))
tri.set_alpha(0.5)
tri.set_edgecolor('k')
ax.add_collection3d(tri)
plt.show()