From c56496d9f28d8db478dc663aebc96fa7b657f67f Mon Sep 17 00:00:00 2001 From: Divyansh-jain2 <142875929+Divyansh-jain2@users.noreply.github.com> Date: Fri, 4 Oct 2024 22:33:44 +0530 Subject: [PATCH] chore: use M_PI instead of PI parameter (#2747) * changed PI variable value from 3.14 to M_PI * changed PI variable to M_PI * changed the degree_to_radians function * comments removed * docs: remove pi param * fix: typo in function name * changed degree to degrees --------- Co-authored-by: [Divyansh Jain] <[jdivyansh51@gmail.com]> Co-authored-by: realstealthninja <68815218+realstealthninja@users.noreply.github.com> --- physics/ground_to_ground_projectile_motion.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/physics/ground_to_ground_projectile_motion.cpp b/physics/ground_to_ground_projectile_motion.cpp index f2551935e74..af362c524a4 100644 --- a/physics/ground_to_ground_projectile_motion.cpp +++ b/physics/ground_to_ground_projectile_motion.cpp @@ -10,6 +10,7 @@ */ #include /// for assert() +#define _USE_MATH_DEFINES #include /// for std::pow(), std::sin(), and std::cos() #include /// for IO operations @@ -27,11 +28,12 @@ namespace ground_to_ground_projectile_motion { /** * @brief Convert radians to degrees * @param radian Angle in radians - * @param PI The definition of the constant PI * @returns Angle in degrees */ -double degrees_to_radians(double radian, double PI = 3.14) { - return (radian * (PI / 180)); + +double degrees_to_radians(double degrees){ + double radians = degrees * (M_PI / 180); + return radians; } /**