Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import math
  2.  
  3. P = 0
  4. D = 1
  5. W = 2
  6.  
  7. #P D W
  8. length = [1, 1, 1]
  9.  
  10. minValue = [10, 10, 10]
  11. maxValue = [30, 30, 30]
  12. increment = [10, 10, 10]
  13.  
  14. for thetaP in range (minValue[P], maxValue[D], increment[W]):
  15. positionPx = length[P] * math.cos (thetaP * math.pi / 180)
  16. positionPy = length[P] * math.sin (thetaP * math.pi / 180)
  17.  
  18. for thetaD in range (minValue[D], maxValue[D], increment[D]):
  19. positionDx = positionPx + length[D] * math.cos ((thetaP + thetaD) * math.pi / 180)
  20. positionDy = positionPy + length[D] * math.sin ((thetaP + thetaD) * math.pi / 180)
  21.  
  22. for thetaW in range (minValue[W], maxValue[W], increment[W]):
  23. positionWx = positionDx + length[W] * math.cos ((thetaP + thetaD + thetaW) * math.pi / 180)
  24. positionWy = positionDy + length[W] * math.sin ((thetaP + thetaD + thetaW) * math.pi / 180)
  25.  
  26. print ('positionPx', positionPx, 'positionPy', positionPy)
  27. print ('positionDx', positionDx, 'positionDy', positionDy)
  28. print ('positionWx', positionWx, 'positionWy', positionWy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement