changed return val from course to int16

This commit is contained in:
2022-12-28 10:21:52 +01:00
parent 9d5cc92a80
commit 4495ffe293
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -59,22 +59,22 @@ double Point::distanceTo(const Point &point) const {
return this->distanceTo(point.getCoordinates());
}
double Point::courseTo(const Coordinates& point) const {
int16_t Point::courseTo(const Coordinates& point) const {
Coordinates begin = this->coordinates;
Coordinates end = point;
double phi = log( tan(end.lat * ROUTE_DEGREE_TO_RADIANT / 2 + ROUTE_PI / 4) / tan(begin.lat * ROUTE_DEGREE_TO_RADIANT / 2 + ROUTE_PI / 4) );
double lon = (begin.lon * ROUTE_DEGREE_TO_RADIANT - end.lon * ROUTE_DEGREE_TO_RADIANT);
double res = atan2(lon, phi) / ROUTE_DEGREE_TO_RADIANT;
int16_t res = (int16_t) atan2(lon, phi) / ROUTE_DEGREE_TO_RADIANT;
// if (res < 0)
// res += 360.0;
// res += 360;
return res;
}
double Point::courseTo(const Point &point) const {
int16_t Point::courseTo(const Point &point) const {
return this->courseTo(point.getCoordinates());
}
+2 -2
View File
@@ -79,8 +79,8 @@ class Point{
double distanceTo(const Coordinates& point) const;
double distanceTo(const Point& point) const;
double courseTo(const Coordinates& point) const;
double courseTo(const Point& point) const;
int16_t courseTo(const Coordinates& point) const;
int16_t courseTo(const Point& point) const;
double getLongitude() const { return this->coordinates.lon; }
double getLatitude() const { return this->coordinates.lat; }