I am new to 3d graphics. I just want to build a pyramid of 5 points and cut a plane through it. My problem is that I do not know how to fill in the parties.
points = np.array([[-1, -1, -1], [1, -1, -1 ], [1, 1, -1], [-1, 1, -1], [0, 0 , 1]]) fig = plt.figure() ax = fig.add_subplot(111, projection='3d') r = [-1,1] X, Y = np.meshgrid(r, r) ax.plot_surface(X,Y,-1, alpha=0.5) ax.plot_surface(X,Y,0.5, alpha=0.5, facecolors='r') ax.scatter3D(points[:, 0], points[:, 1], points[:, 2]) ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') plt.show()
Any help is appreciated.
source share