Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. #pragma GCC optimize("03")
  2. #include <bits/stdc++.h>
  3. #define ll long long
  4. #define MOD 1000000007
  5. #define PI 3.14159265359
  6.  
  7. using namespace std;
  8.  
  9. double wheelBase, dist, steeringAngle;
  10.  
  11. int main(){
  12. ios_base::sync_with_stdio(0);
  13. cin.tie(NULL);
  14. cin >> wheelBase >> dist >> steeringAngle;
  15.  
  16. steeringAngle = abs(steeringAngle);
  17.  
  18. double turnRadius = wheelBase / sin(steeringAngle * PI / 180);
  19. double supportAngle = (dist * 180) / (PI * turnRadius);
  20.  
  21. double anglePitagora = 90 - supportAngle / 2;
  22. double coarda = 2 * turnRadius * sin((supportAngle / 2 )* PI / 180);
  23.  
  24. double newPosY = coarda * sin(anglePitagora * PI / 180);
  25. double newPosX = coarda * cos(anglePitagora * PI / 180);
  26.  
  27. double distPerDegree = 2 * PI * turnRadius / 360;
  28.  
  29. // cout << coarda << " ";
  30.  
  31. while (supportAngle < 0) supportAngle += 360;
  32. cout << setprecision(2) << fixed << newPosX << " " << newPosY << " " << supportAngle << "\n";
  33.  
  34. return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement