changed return val from course to int16
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user