L2C/coordinate_conversion.h

27 lines
1.1 KiB
C
Raw Normal View History

2024-09-20 00:57:41 -06:00
#ifndef COORDINATE_CONVERSION_H
#define COORDINATE_CONVERSION_H
/**
* @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
*/
void polar_to_cartesian(double radius, double angle, double* xCoordinate, double* yCoordinate);
/**
* @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
*/
void cartesian_to_polar(double xCoordinate, double yCoordinate, double* radius, double* angle);
#endif // COORDINATE_CONVERSION_H