Fix angle conversion for cartesian -> polar
This commit is contained in:
parent
6988fbc7f9
commit
23003e0d34
1 changed files with 1 additions and 1 deletions
|
@ -11,7 +11,7 @@ void polar_to_cartesian(double radius, double angle, double *xCoordinate,
|
||||||
void cartesian_to_polar(double xCoordinate, double yCoordinate, double *radius,
|
void cartesian_to_polar(double xCoordinate, double yCoordinate, double *radius,
|
||||||
double *angle) {
|
double *angle) {
|
||||||
*radius = std::sqrt(std::pow(xCoordinate, 2) + std::pow(yCoordinate, 2));
|
*radius = std::sqrt(std::pow(xCoordinate, 2) + std::pow(yCoordinate, 2));
|
||||||
*angle = std::atan(xCoordinate);
|
*angle = std::atan(xCoordinate / yCoordinate);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // COORDINATE_CONVERSION_H
|
#endif // COORDINATE_CONVERSION_H
|
||||||
|
|
Loading…
Reference in a new issue