Guest User

Untitled

a guest
Feb 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. C
  2. /
  3. /
  4. /
  5. /
  6. /
  7. A - - - - - B
  8.  
  9. source_direction=atan2(a+b+2c,a-b)*180/pi;
  10. if(a>b){
  11. if(b>c){//a>b>c
  12. possible_center_direction=240; //A is closest, then B, last C
  13. }else if(a>c){//a>c>b
  14. possible_center_direction=180; //A is closest, then C last B
  15. }else{//c>a>b
  16. possible_center_direction=120; //C is closest, then A last B
  17. }
  18. }else{
  19. if(c>b){//c>b>a
  20. possible_center_direction=60; //C is closest, then B, last A
  21. }else if(a>c){//b>a>c
  22. possible_center_direction=300; //B is closest, then A, last C
  23. }else{//b>c>a
  24. possible_center_direction=0; //B is closest, then C, last A
  25. }
  26. }
  27.  
  28. //if the source is out of bounds, then rotate it by 180 degrees.
  29. if((possible_center_direction+60)<source_direction){
  30. if(source_direction>(possible_center_direction-60)){
  31. source_direction=(source_direction+180)%360;
  32. }
  33. }
  34.  
  35. true_true_direction = true_true_direction*0.9+source_direction*0.1;
Add Comment
Please, Sign In to add comment