脚本是从MATLAB程序移植过来的,主要是sphere函数生成球形表面,再进行调整。
# Snack Jack pumpkin
[X,Y,Z] = sphere(160)
R = 1+(-(1-mod(arange(0,16.1,.1).reshape(1,-1),2))**2)/40+ \
(-(1-mod(arange(0,32.1,.2).reshape(1,-1),2))**2)/40
axes3d(aspect='equal', axis=None, axes_zoom=True)
lighting()
material([0.6,0.7,0.2,100,0.5])
surf(R*X, R*Y, (.8+(0-arange(1,-1.01,-.0125).reshape(1,-1).T**4)*.3)*Z*R*1.2,
facecolor='#e60', edgecolor=None)
# Recycle the sphere coords for the stem.
surf(X/15, Y/15, Z/2+.6, facecolor='#040', edgecolor=None)