bind进来(已binding的有polygon, kd-tree等)。
VPython homepage http://vpython.org/
py.CGAL.visual project
http://cgi.di.uoa.gr/~compgeom/pycgalvisual/
Installation under Ubuntu
sudo apt-get install python-visual # need gtk, boost,numpy
Example : 一个小球撞击地板的动画
(from http://vpython.org/vpythonprog.htm )
#!/usr/bin/python
from visual import *
floor = box (pos=(0,0,0), length=4, height=0.5, width=4, color=color.blue)
ball = sphere (pos=(0,4,0), radius=1, color=color.red)
ball.velocity = vector(0,-1,0)
dt = 0.01
while 1:
rate (100)
ball.pos = ball.pos + ball.velocity*dt
if ball.y < ball.radius:ball.velocity.y = -ball.velocity.y
else:ball.velocity.y = ball.velocity.y - 9.8*dt
没有评论:
发表评论