np.cos(phy) * np.cos(thetas[0]),
    np.cos(phy) * np.sin(thetas[0]),
    np.sin(phy)
])
light_xyz_2 = np.array([
    np.cos(phy) * np.cos(thetas[1]),
    np.cos(phy) * np.sin(thetas[1]),
    np.sin(phy)
])
light_xyz_3 = np.array([
    np.cos(phy) * np.cos(thetas[2]),
    np.cos(phy) * np.sin(thetas[2]),
    np.sin(phy)
])
image1 = render.render_lambert_gray(shape_nx=mesh_nx,
                                    shape_ny=mesh_ny,
                                    shape_nz=mesh_nz,
                                    light_xyz=light_xyz_1)
image2 = render.render_lambert_gray(shape_nx=mesh_nx,
                                    shape_ny=mesh_ny,
                                    shape_nz=mesh_nz,
                                    light_xyz=light_xyz_2)
image3 = render.render_lambert_gray(shape_nx=mesh_nx,
                                    shape_ny=mesh_ny,
                                    shape_nz=mesh_nz,
                                    light_xyz=light_xyz_3)
### plot rendered shape
# fig = plt.figure()
# plt.subplot(131)
# plt.imshow(image1,cmap='gray')
# plt.axis('off')
# plt.subplot(132)
Example #2
0
# ax = Axes3D(fig)
wireframe = ax.plot_wireframe(array_mesh_x[::2,::2], array_mesh_y[::2,::2], array_mesh_z[::2,::2],
                              rstride=1, cstride=1, linestyles = 'solid',linewidth=0.1 ,edgecolor = 'gray')
quiver = ax.quiver(array_mesh_x[::2,::2], array_mesh_y[::2,::2], array_mesh_z[::2,::2],
                   0.1*array_mesh_nx[::2,::2], 0.1*array_mesh_ny[::2,::2], 0.1*array_mesh_nz[::2,::2])
ax.grid(False)
ax.auto_scale_xyz([0,8], [0,8], [-3,5])
plt.show()

### render the shape
phy = 60* np.pi/180
thetas = np.array([90, -90])* np.pi/180
light_xyz_1  = np.array([np.cos(phy)*np.cos(thetas[0]), np.cos(phy)*np.sin(thetas[0]), np.sin(phy)])
light_xyz_2  = np.array([np.cos(phy)*np.cos(thetas[1]), np.cos(phy)*np.sin(thetas[1]), np.sin(phy)])
image1 = render.render_lambert_gray(shape_nx = array_mesh_nx,
                                    shape_ny = array_mesh_ny,
                                    shape_nz = array_mesh_nz,
                                    light_xyz  = light_xyz_1)
image2 = render.render_lambert_gray(shape_nx = array_mesh_nx,
                                    shape_ny = array_mesh_ny,
                                    shape_nz = array_mesh_nz,
                                    light_xyz  = light_xyz_2)
### plot rendered shape
fig = plt.figure()
plt.subplot(121)
plt.imshow(image1,cmap='gray')
plt.axis('off')
plt.subplot(122)
plt.imshow(image2,cmap='gray')
plt.axis('off')
plt.show()