Guest User

Untitled

a guest
Apr 20th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. @interact
  2. def projectile(longitude=0 , latitude=0 , north_south=0 , west_east=0 , velocity=100):
  3.  
  4. earth_r = 6371
  5. altitude = 100
  6. globe_color = "blue"
  7. coord_step = 30
  8. coord_color = "red"
  9. coord_weight = 8
  10.  
  11. map = implicit_plot3d( x^2+y^2+z^2=earth_r^2 , (x,-(r+altitude),r+altitude) , (y,-(r+altitude),r+altitude) , (z,-(r+altitude),r+altitude) , opacity=.3 , color=globe_color )
  12. for i in srange( 0 , pi , coord_step*pi/180 ) :
  13. map += parametric_plot3d( ( earth_r*sin(t)*cos(i) , earth_r*sin(t)*cos(i) , earth_r*sin(t)*sin(i) ), (t,0,2*pi) , size=coord_weight , color=coord_color )
  14. for i in srange( -pi/2 , pi/2+.00001 , coord_step*pi/180 ) :
  15. map += parametric_plot3d( ( earth_r*cos(t)*cos(i) , earth_r*sin(t)*cos(i) , earth_r*sin(i) ) , (t,0,2*pi) , size=coord_weight , color=coord_color )
  16.  
  17. p0 = ( earth_r*cos(longitude*pi/180)*cos(latitude*pi/180) , earth_r*sin(longitude*pi/180)*cos(latitude*pi/180) , earth_r*sin(latitude*pi/180) )
  18.  
  19. position_arrow = arrow( (0,0,0) , p0 )
  20.  
  21. d0 = vector([ cos((longitude+west_east)*pi/180)*cos((latitude+north_south)*pi/180) , sin((longitude+west_east)*pi/180)*cos((latitude+north_south)*pi/180) , sin((latitude+north_south)*pi/180) ])
  22. velocity_arrow = arrow( p0 , p0+d0*velocity )
  23.  
  24. show(map)
Add Comment
Please, Sign In to add comment