From 23003e0d341e5c0968281c8c54dbd1b8525e2fa87e742d535dbff543536e819b Mon Sep 17 00:00:00 2001 From: Tyler Beckman Date: Fri, 20 Sep 2024 11:09:35 -0600 Subject: [PATCH] Fix angle conversion for cartesian -> polar --- coordinate_conversion.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coordinate_conversion.cpp b/coordinate_conversion.cpp index 06c5663..bbb99a4 100644 --- a/coordinate_conversion.cpp +++ b/coordinate_conversion.cpp @@ -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