椭圆形和其他形状内的弹跳球vpython

怎么样? 我敢肯定这应该很简单...已经尝试过了 希望朝着正确的方向前进(新手)

lips = ellipsoid(pos=vector(0,0,0),opacity=.4)
lips.axis=vector(2,0,0)


ball = sphere (color = color.green, radius = 0.1, make_trail=True, retain=200)
ball.mass = 1.0
ball.p = vector (-0.15, -0.23, +0.27)

dt = 0.3
while True:
    rate(200)
    ball.pos = ball.pos + (ball.p/ball.mass)*dt
    if not (lips > ball.pos.x > -lips):
        ball.p.x = -ball.p.x
    if not (lips > ball.pos.y > -lips):
        ball.p.y = -ball.p.y
    if not (lips > ball.pos.z > -lips):
        ball.p.z = -ball.p.z