Skip to content

Commit c56496d

Browse files
Divyansh-jain2[Divyansh Jain]realstealthninja
authored
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>
1 parent 901f231 commit c56496d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

physics/ground_to_ground_projectile_motion.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <cassert> /// for assert()
13+
#define _USE_MATH_DEFINES
1314
#include <cmath> /// for std::pow(), std::sin(), and std::cos()
1415
#include <iostream> /// for IO operations
1516

@@ -27,11 +28,12 @@ namespace ground_to_ground_projectile_motion {
2728
/**
2829
* @brief Convert radians to degrees
2930
* @param radian Angle in radians
30-
* @param PI The definition of the constant PI
3131
* @returns Angle in degrees
3232
*/
33-
double degrees_to_radians(double radian, double PI = 3.14) {
34-
return (radian * (PI / 180));
33+
34+
double degrees_to_radians(double degrees){
35+
double radians = degrees * (M_PI / 180);
36+
return radians;
3537
}
3638

3739
/**

0 commit comments

Comments
 (0)