我想做一个用vpython展示达芬奇塔的程序,我想我得到了正确的代码来按顺序旋转楼层,就像达芬奇塔一样。但是vpython没有响应。我做错了什么?有人能帮帮忙吗?
from visual import *
from math import *
scene.autocenter=True
print "Give the desired square meters per floor:"
SquareMeters= int(raw_input());
side=sqrt(SquareMeters)
print "Give the desired height of the tower in meters"
demandedHeight= int(raw_input());
totalFloors = demandedHeight/3;
carryingStructure= cylinder(pos=(0,-1,0), axis=(0,demandedHeight,0), radius=10)
height=0;
floors=[]
v=frame()
while height < demandedHeight:
f = box(frame=v,pos=(0,height,0),size=(side,3,side))
floors.append(f)
height += 3.5
f
print totalFloors;
for floorNr in range(len(floors)):
floor = floors[floorNr]
floor.rotate(angle=0.01*floorNr, axis=(0,1,0), origin=(0,0,0)) 发布于 2014-01-08 11:39:07
这并不是说vpython没有响应,如果你放大你的圆柱体,你会看到地板包含在它里面。你需要让你的地板更大,而且你的角度0.01*floorNr非常小。我会试试0.1*floorNr。
此外,在python中,您不会将分号放在行尾。
https://stackoverflow.com/questions/20807971
复制相似问题