Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / geometry / example / ml03_distance_formula.cpp
1 // Boost.Geometry
2
3 // Copyright (c) 2018 Adeel Ahmad, Islamabad, Pakistan.
4
5 // Contributed and/or modified by Adeel Ahmad, as part of Google Summer of Code 2018 program.
6
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 // Formula example - Show how to use Karney's direct method.
12
13 #include <boost/geometry.hpp>
14 #include <boost/geometry/formulas/karney_direct.hpp>
15
16 using namespace boost::geometry;
17
18 int main()
19 {
20     double lon1_deg = 0.;
21     double lat1_deg = 73.114273316483;
22     double distance_m = 19992866.6147806;
23     double azi12_deg = 78.154765899661;
24
25     // Create an alias of the formula.
26     typedef formula::karney_direct<double, true, true, true, true, 8> karney_direct;
27
28     // Structure to hold the resulting values.
29     formula::result_direct<double> result;
30
31     // WGS-84 spheroid.
32     srs::spheroid<double> spheroid(6378137.0, 6356752.3142451793);
33
34     result = karney_direct::apply(lon1_deg, lat1_deg, distance_m, azi12_deg, spheroid);
35
36     return 0;
37 }