像使用 Axes3D.plot_trisurf() 一样绘制 Trimesh 对象

van*_*nia 3 python 3d mplot3d trimesh

我有一个 Trimesh 对象,但我不知道如何绘制它。我的目标是 mplot3d 中的 Axes3D.plot_trisurf() 函数会产生类似的结果(见下文)。Trimesh 对象甚至有一个包含面的属性,但我不知道从哪里获取网格点的坐标。

感谢您的任何想法!

mplot3d 中的 trisurf 图

www*_*ger 6

你可以这样做,mesh你的 Trimesh 对象在哪里:

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_trisurf(mesh.vertices[:, 0], mesh.vertices[:,1], triangles=mesh.faces, Z=mesh.vertices[:,2]) 
plt.show()
Run Code Online (Sandbox Code Playgroud)

用plot_trisurf绘制凌乱的修剪网格

你可能需要调整比例、宽高比、旋转等。