ml03_distance_formula.cpp 1.1 KB

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