python 3d绘图立方体_用python绘制三维立方体的二维投影

你很幸运我正好回答了这个问题,Plot 3D convex closed regions in matplot lib,

最近。方法可能非常相似。首先将三角形简化为立方体的面(这在链接的答案中完成),然后只需移除隐藏的面。这里的方法是沿着观察方向按质心对面进行排序,然后删除最后3个面。

最后通过去除y维来实现二维投影。在from scipy.spatial import ConvexHull

import numpy as np

import matplotlib.pyplot as plt

from matplotlib.collections import PolyCollection

import mpl_toolkits.mplot3d as a3

from mpl_toolkits.mplot3d import Axes3D

x = np.array([ 0.16257299, -0.370805 , -1.09232295, 1.62570095,

-1.62570095, 1.09232295, 0.370805 , -0.16257299])

y = np.array([-1.71022499, -0.81153202, -0.52910602, -0.36958599,

0.369587 , 0.52910602, 0.81153202, 1.71022499])

z = np.array([ 0.22068501, -1.48456001, 1.23566902, 0.469576 ,

-0.469576 , -1.23566902, 1.48456001, -0.22068501])

verts = np.c_[x,y,z]

hull = ConvexHull(verts)

simplices = hull.simplices

org_tri

你可能感兴趣的:(python,3d绘图立方体)