Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from visual import *
- scene=display(title="ball drop",x=0, y=0, width=800,
- height=600,range=vector(10000,10000,10000),
- center=vector(0,0,0))
- t = 0.0
- C = 0.8 #<- This is our drag coefficient
- dt = 0.1
- m = 70
- a = vector(0.0,0.0,0.0) # This is our acceleration
- A = 3.14159*0.4*0.4
- rho = 1.2
- s = vector(0.0, 5000.0, 0.0)
- v = vector(0.0,0.0,0.0)
- g = vector(0.0,9.8,0.0)
- ball = sphere(pos=s,radius = 200, color = color.blue)
- balllabel = label(pos=ball.pos,text = 'Vy=%1.2f' %v.y,
- xoffset=-100,yoffset=0)
- balllabel2 = label(pos=ball.pos,text='Distance Fallen = %1.2f' %s.y,
- xoffset=100,yoffset=0)
- while t < 50:
- rate(50) # This slows down the computer to 50 frames per second
- fnet = 0.5*C*rho*A*vector(0,mag2(v),0)-m*g # <-- Current force on skydiver
- a = fnet/m # <-- current acceleration on skydiver
- v = v + a*dt
- s = s+v*dt
- ball.pos=s
- balllabel.pos=s
- balllabel.text='v=%1.2f m/s' %v.y
- balllabel2.text='Vertical Position=%1.1f m' %(s.y)
- print 't=',t , ' s=',s, ' v=',v
- t = t + dt
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement