import numpy as np
import wxgl
from PIL import Image
app = wxgl.App()
im = np.array(Image.open('res/paper.png'))/255
rows, cols, deep = im.shape
r = 1
h = 2*np.pi*rows/cols
theta = np.linspace(0, 2*np.pi, cols)
x = r * np.cos(theta)
y = r * np.sin(theta)
z = np.linspace(0, h, rows)
xs = np.tile(x, (rows,1))
ys = np.tile(y, (rows,1))
zs = z.repeat(cols).reshape((rows,cols))
app.mesh(xs, ys, zs, texture='res/paper.png')
def f3():
theta = np.linspace(0, 2*np.pi, 18, endpoint=False)
x = r * np.cos(theta)
y = r * np.sin(theta)
x[2::3] = x[1::3]
x[1::3] = 0
y[2::3] = y[1::3]
y[1::3] = 0
z = np.ones(18) * h * 0.9
vs = np.stack((x,y,z), axis=1)
app.surface(vs, color='#C03000', opacity=0.8)
f3()
app.sphere((0,0,h*0.4),0.4)
#app.line([(0,0), (0,0), (0.4*h, 1.5*h)], width=3.0)
print(app.line.__doc__)
print(app.sphere.__doc__)
print(app.surface.__doc__)
print(app.mesh.__doc__)
app.show()
02-26
3948
3948
12-22
1276
1276

被折叠的 条评论
为什么被折叠?



