mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 08:06:35 +00:00
Changed directory structure and renamed applications
- autopilot -> drone_controller - rtsp_ai_player -> ai_controller - added top level qmake project file - updated documentation - moved small demo applications from tmp/ to misc/
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#include "az_utils.h"
|
||||
#include <math.h>
|
||||
|
||||
AzUtils::AzUtils() {}
|
||||
|
||||
#define EARTH_RADIUS 6371.0 // Earth radius in kilometers
|
||||
|
||||
double degrees_to_radians(double degrees)
|
||||
{
|
||||
return degrees * M_PI / 180.0;
|
||||
}
|
||||
|
||||
double AzUtils::distance(double lat1, double lon1, double lat2, double lon2)
|
||||
{
|
||||
double dlat = degrees_to_radians(lat2 - lat1);
|
||||
double dlon = degrees_to_radians(lon2 - lon1);
|
||||
double a = sin(dlat / 2) * sin(dlat / 2)
|
||||
+ cos(degrees_to_radians(lat1)) * cos(degrees_to_radians(lat2)) * sin(dlon / 2) * sin(dlon / 2);
|
||||
double c = 2 * atan2(sqrt(a), sqrt(1 - a));
|
||||
return EARTH_RADIUS * c;
|
||||
}
|
||||
Reference in New Issue
Block a user