Fix angle conversion for cartesian -> polar

This commit is contained in:
Tyler Beckman 2024-09-20 11:09:35 -06:00
parent 6988fbc7f9
commit 23003e0d34
Signed by: Ty
GPG key ID: 2813440C772555A4

View file

@ -11,7 +11,7 @@ void polar_to_cartesian(double radius, double angle, double *xCoordinate,
void cartesian_to_polar(double xCoordinate, double yCoordinate, double *radius,
double *angle) {
*radius = std::sqrt(std::pow(xCoordinate, 2) + std::pow(yCoordinate, 2));
*angle = std::atan(xCoordinate);
*angle = std::atan(xCoordinate / yCoordinate);
}
#endif // COORDINATE_CONVERSION_H