Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from math import *
  3. from sys import argv
  4. from decimal import *
  5.  
  6. def calc():
  7. xa = float(argv[1])
  8. ya = float(argv[2])
  9. za = float(argv[3])
  10. xb = float(argv[4])
  11. yb = float(argv[5])
  12. zb = float(argv[6])
  13.  
  14. x = float(argv[4]) - float(argv[1])
  15. y = float(argv[5]) - float(argv[2])
  16. z = float(argv[6]) - float(argv[3])
  17. Cx = xb
  18. Cy = yb
  19. Cz = zb
  20. print 'The speed vector coordinates are :'
  21. print '(%.2f;%.2f;%.2f)' %(x, y, z)
  22.  
  23. print 'At time t+' + str(int(argv[7])) + ' ball coordinates will be:'
  24.  
  25. for i in range(int(argv[7])):
  26. Cx = Cx + x
  27. Cy = Cy + y
  28. Cz = Cz + z
  29.  
  30. print '(%.2f;%.2f;%.2f)' %(Cx, Cy, Cz)
  31. if argv[6] < 0:
  32. print 'The ball wont reach the bat.'
  33. if argv[6] >= 0:
  34. print 'The incidence angle is :'
  35. A = (zb - za) / sqrt(pow(xb-xa , 2) + pow(yb - ya, 2) + pow(zb - za, 2))
  36. A = 180 * acos(A) / pi - 90
  37.  
  38. if A < 0:
  39. A = -A
  40.  
  41. print '%.2f degres' %(A)
  42.  
  43.  
  44. calc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement