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());
|
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 begin = this->coordinates;
|
||||||
Coordinates end = point;
|
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 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 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)
|
// if (res < 0)
|
||||||
// res += 360.0;
|
// res += 360;
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
double Point::courseTo(const Point &point) const {
|
int16_t Point::courseTo(const Point &point) const {
|
||||||
return this->courseTo(point.getCoordinates());
|
return this->courseTo(point.getCoordinates());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -79,8 +79,8 @@ class Point{
|
|||||||
|
|
||||||
double distanceTo(const Coordinates& point) const;
|
double distanceTo(const Coordinates& point) const;
|
||||||
double distanceTo(const Point& point) const;
|
double distanceTo(const Point& point) const;
|
||||||
double courseTo(const Coordinates& point) const;
|
int16_t courseTo(const Coordinates& point) const;
|
||||||
double courseTo(const Point& point) const;
|
int16_t courseTo(const Point& point) const;
|
||||||
|
|
||||||
double getLongitude() const { return this->coordinates.lon; }
|
double getLongitude() const { return this->coordinates.lon; }
|
||||||
double getLatitude() const { return this->coordinates.lat; }
|
double getLatitude() const { return this->coordinates.lat; }
|
||||||
|
|||||||
Reference in New Issue
Block a user