reformat code source file
This commit is contained in:
parent
3fa12445a5
commit
814d9aa01b
@ -39,6 +39,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
constexpr static const float RAD = 0.017453292519943295769236907684886;
|
constexpr static const float RAD = 0.017453292519943295769236907684886;
|
||||||
|
// earth radius varies between 6,356.750-6,378.135 km (3,949.901-3,963.189mi)
|
||||||
|
// The IUGG value for the equatorial radius is 6378.137 km (3963.19 miles)
|
||||||
constexpr static const float earth_radius = 6372797.560856f;
|
constexpr static const float earth_radius = 6372797.560856f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,10 +66,9 @@ double coordinate_calculation::great_circle_distance(const int lat1,
|
|||||||
const double dLong = dlong1 - dlong2;
|
const double dLong = dlong1 - dlong2;
|
||||||
const double dLat = dlat1 - dlat2;
|
const double dLat = dlat1 - dlat2;
|
||||||
|
|
||||||
const double aHarv = pow(sin(dLat / 2.0), 2.0) + cos(dlat1) * cos(dlat2) * pow(sin(dLong / 2.), 2);
|
const double aHarv =
|
||||||
|
pow(sin(dLat / 2.0), 2.0) + cos(dlat1) * cos(dlat2) * pow(sin(dLong / 2.), 2);
|
||||||
const double cHarv = 2. * atan2(sqrt(aHarv), sqrt(1.0 - aHarv));
|
const double cHarv = 2. * atan2(sqrt(aHarv), sqrt(1.0 - aHarv));
|
||||||
// earth radius varies between 6,356.750-6,378.135 km (3,949.901-3,963.189mi)
|
|
||||||
// The IUGG value for the equatorial radius is 6378.137 km (3963.19 miles)
|
|
||||||
return earth_radius * cHarv;
|
return earth_radius * cHarv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,7 @@ struct coordinate_calculation
|
|||||||
static float euclidean_distance(const FixedPointCoordinate &first_coordinate,
|
static float euclidean_distance(const FixedPointCoordinate &first_coordinate,
|
||||||
const FixedPointCoordinate &second_coordinate);
|
const FixedPointCoordinate &second_coordinate);
|
||||||
|
|
||||||
static float
|
static float euclidean_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
||||||
euclidean_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
|
||||||
|
|
||||||
static void lat_or_lon_to_string(const int value, std::string &output);
|
static void lat_or_lon_to_string(const int value, std::string &output);
|
||||||
|
|
||||||
@ -86,4 +85,4 @@ struct coordinate_calculation
|
|||||||
static float rad_to_deg(const float radian);
|
static float rad_to_deg(const float radian);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif //COORDINATE_CALCULATION
|
#endif // COORDINATE_CALCULATION
|
||||||
|
Loading…
Reference in New Issue
Block a user