Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("03")
- #include <bits/stdc++.h>
- #define ll long long
- #define MOD 1000000007
- #define PI 3.14159265359
- using namespace std;
- double wheelBase, dist, steeringAngle;
- int main(){
- ios_base::sync_with_stdio(0);
- cin.tie(NULL);
- cin >> wheelBase >> dist >> steeringAngle;
- steeringAngle = abs(steeringAngle);
- double turnRadius = wheelBase / sin(steeringAngle * PI / 180);
- double supportAngle = (dist * 180) / (PI * turnRadius);
- double anglePitagora = 90 - supportAngle / 2;
- double coarda = 2 * turnRadius * sin((supportAngle / 2 )* PI / 180);
- double newPosY = coarda * sin(anglePitagora * PI / 180);
- double newPosX = coarda * cos(anglePitagora * PI / 180);
- double distPerDegree = 2 * PI * turnRadius / 360;
- // cout << coarda << " ";
- while (supportAngle < 0) supportAngle += 360;
- cout << setprecision(2) << fixed << newPosX << " " << newPosY << " " << supportAngle << "\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement