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
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
@ -64,10 +66,9 @@ double coordinate_calculation::great_circle_distance(const int lat1,
|
||||
const double dLong = dlong1 - dlong2;
|
||||
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));
|
||||
// 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;
|
||||
}
|
||||
|
||||
@ -75,14 +76,14 @@ double coordinate_calculation::great_circle_distance(const FixedPointCoordinate
|
||||
const FixedPointCoordinate &coordinate_2)
|
||||
{
|
||||
return great_circle_distance(coordinate_1.lat, coordinate_1.lon, coordinate_2.lat,
|
||||
coordinate_2.lon);
|
||||
coordinate_2.lon);
|
||||
}
|
||||
|
||||
float coordinate_calculation::euclidean_distance(const FixedPointCoordinate &coordinate_1,
|
||||
const FixedPointCoordinate &coordinate_2)
|
||||
{
|
||||
return euclidean_distance(coordinate_1.lat, coordinate_1.lon, coordinate_2.lat,
|
||||
coordinate_2.lon);
|
||||
coordinate_2.lon);
|
||||
}
|
||||
|
||||
float coordinate_calculation::euclidean_distance(const int lat1,
|
||||
|
@ -43,10 +43,9 @@ struct coordinate_calculation
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
|
||||
static float euclidean_distance(const FixedPointCoordinate &first_coordinate,
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
const FixedPointCoordinate &second_coordinate);
|
||||
|
||||
static float
|
||||
euclidean_distance(const int lat1, const int lon1, const int lat2, const int lon2);
|
||||
static float 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);
|
||||
|
||||
@ -67,18 +66,18 @@ struct coordinate_calculation
|
||||
float &ratio);
|
||||
|
||||
static float perpendicular_distance_from_projected_coordinate(
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate);
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate);
|
||||
|
||||
static float perpendicular_distance_from_projected_coordinate(
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate,
|
||||
FixedPointCoordinate &nearest_location,
|
||||
float &ratio);
|
||||
const FixedPointCoordinate &segment_source,
|
||||
const FixedPointCoordinate &segment_target,
|
||||
const FixedPointCoordinate &query_location,
|
||||
const std::pair<double, double> &projected_coordinate,
|
||||
FixedPointCoordinate &nearest_location,
|
||||
float &ratio);
|
||||
|
||||
static float GetBearing(const FixedPointCoordinate &A, const FixedPointCoordinate &B);
|
||||
|
||||
@ -86,4 +85,4 @@ struct coordinate_calculation
|
||||
static float rad_to_deg(const float radian);
|
||||
};
|
||||
|
||||
#endif //COORDINATE_CALCULATION
|
||||
#endif // COORDINATE_CALCULATION
|
||||
|
Loading…
Reference in New Issue
Block a user