diff --git a/coordinate_conversion.cpp b/coordinate_conversion.cpp index bbb99a4..38c4213 100644 --- a/coordinate_conversion.cpp +++ b/coordinate_conversion.cpp @@ -2,16 +2,16 @@ #define COORDINATE_CONVERSION_H #include -void polar_to_cartesian(double radius, double angle, double *xCoordinate, - double *yCoordinate) { - *xCoordinate = radius * std::cos(angle); - *yCoordinate = radius * std::sin(angle); +void polar_to_cartesian(const double RADIUS, const double ANGLE, double *pXCoordinate, + double *pYCoordinate) { + *pXCoordinate = RADIUS * std::cos(ANGLE); + *pYCoordinate = RADIUS * std::sin(ANGLE); } -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 / yCoordinate); +void cartesian_to_polar(const double X_COORDINATE, const double Y_COORDINATE, double *pRadius, + double *pAngle) { + *pRadius = std::sqrt(std::pow(X_COORDINATE, 2) + std::pow(Y_COORDINATE, 2)); + *pAngle = std::atan(X_COORDINATE / Y_COORDINATE); } #endif // COORDINATE_CONVERSION_H diff --git a/coordinate_conversion.h b/coordinate_conversion.h index 8b24e4b..c9c195b 100644 --- a/coordinate_conversion.h +++ b/coordinate_conversion.h @@ -5,22 +5,22 @@ * @brief Converts passed polar coordinates to their cartesian equivalent, using * pass-by-pointer * - * @param radius The radius of the polar coordinates - * @param angle The angle of the polar coordinates - * @param xCoordinate A pointer referencing the variable to place the x component of the cartesian coordinates into - * @param yCoordinate A pointer referencing the variable to place the y component of the cartesian coordinates into + * @param RADIUS The radius of the polar coordinates + * @param ANGLE The angle of the polar coordinates + * @param pXCoordinate A pointer referencing the variable to place the x component of the cartesian coordinates into + * @param pYCoordinate A pointer referencing the variable to place the y component of the cartesian coordinates into */ -void polar_to_cartesian(double radius, double angle, double* xCoordinate, double* yCoordinate); +void polar_to_cartesian(const double RADIUS, const double ANGLE, double* pXCoordinate, double* pYCoordinate); /** * @brief Converts passed cartesian coordinates to their polar equivalent, using * pass-by-pointer * - * @param x The x component of the cartesian coordinates - * @param y The y component of the cartesian coordinates - * @param radius A pointer referencing the variable to put the radius of the polar coordinates into - * @param angle A pointer referencing the variable to put the angle of the polar coordinates into + * @param X_COORDINATE The x component of the cartesian coordinates + * @param Y_COORDINATE The y component of the cartesian coordinates + * @param pRadius A pointer referencing the variable to put the radius of the polar coordinates into + * @param pAngle A pointer referencing the variable to put the angle of the polar coordinates into */ -void cartesian_to_polar(double xCoordinate, double yCoordinate, double* radius, double* angle); +void cartesian_to_polar(const double X_COORDINATE, const double Y_COORDINATE, double* pRadius, double* pAngle); #endif // COORDINATE_CONVERSION_H