其他
用python画一幅美瞳,今日份来自程序员的浪漫
如果说,眼睛是心灵的窗户,那么,美瞳就是心灵的彩窗,就像下图中这样。
u=np.linspace(0,2*pi,100)
v=np.linspace(0,pi,100)
x=a*np.outer(np.cos(u),np.sin(v))
y=a*np.outer(np.sin(u),np.sin(v))
z=b*np.outer(np.ones(np.size(u)),np.cos(v))
#cmap指的是配色方案,默认为纯蓝色,可通过matplotlib.cm.cmap_d.keys()获取所有配色方案,alpha指的是透明度
ax.plot_surface(x,y,z,cmap=value,alpha=0.7)
#将视点的位置偏转90度
ax.view_init(90,0)
for i in np.linspace(0,2*pi,100):
x_yuanzhui=15000000*cos(radians(60))*sin(i)
y_yuanzhui=15000000*cos(radians(60))*cos(i)
z_yuanzhui=10000000-15000000*sin(radians(60))
#linestyle中可以设定线形为破折号
plt.plot([0, x_yuanzhui], [0, y_yuanzhui], [10000000, z_yuanzhui], color='black', linestyle='--')
plt.savefig(filename)
for filename in filenames:
images.append(imageio.imread(filePath+"\\image\\"+filename))
imageio.mimsave(filePath+'\\result.gif',images,duration=0.2)
点击阅读全文,即刻抵达博客
推荐阅读: