gpt-3.5-turbo-0613· OpenAI
WildChat-4.8M (AI2)
simplifie cette fonction float angleX; // Angle en radians entre 0 et 2pi float angleY;…
- User
simplifie cette fonction
float angleX; // Angle en radians entre 0 et 2pi float angleY; // Angle en radians entre -pi/2 et pi/2 float xDirection; // Valeur de direction horizontale float yDirection; // Valeur de direction verticale
void AngleDirection(float x, float y) { const float M_PI = 3.14159f;
angleX = std::fmodf(x, M_PI /2.0f); angleY = std::fmodf((y + M_PI /2.0f), M_PI) - M_PI /2.0f; xDirection = std::cos(angleX); yDirection = std::sin(angleY); cout << xDirection << endl; cout << yDirection << endl;}
- Assistant
Voici la fonction simplifiée :
void AngleDirection(float x, float y) { angleX = std::fmodf(x, M_PI / 2.0f); angleY = std::fmodf(y + M_PI / 2.0f, M_PI) - M_PI / 2.0f;
xDirection = std::cos(angleX); yDirection = std::sin(angleY); cout << xDirection << endl; cout << yDirection << endl;}
- User
simplifie cette fonction en c++
- Assistant
void AngleDirection(float x, float y) { const float M_PI = 3.14159f;
angleX = std::fmodf(x, M_PI / 2.0f); angleY = std::fmodf(y + M_PI / 2.0f, M_PI) - M_PI / 2.0f; xDirection = std::cos(angleX); yDirection = std::sin(angleY); std::cout << xDirection << std::endl; std::cout << yDirection << std::endl;}