diff --git a/lib/Navigation/route.cpp b/lib/Navigation/route.cpp index 8283a5d..75b302f 100644 --- a/lib/Navigation/route.cpp +++ b/lib/Navigation/route.cpp @@ -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()); } diff --git a/lib/Navigation/route.h b/lib/Navigation/route.h index 42e72fd..afa6674 100644 --- a/lib/Navigation/route.h +++ b/lib/Navigation/route.h @@ -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; }