/Src/Dependencies/Boost/libs/geometry/doc/src/examples/core/degree_radian.cpp

http://hadesmem.googlecode.com/ · C++ · 47 lines · 16 code · 12 blank · 19 comment · 0 complexity · 55567cd58c331a3459198f5999132365 MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // QuickBook Example
  3. // Copyright (c) 2011 Barend Gehrels, Amsterdam, the Netherlands.
  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. //[degree_radian
  8. //` Specify two coordinate systems, one in degrees, one in radians.
  9. #include <iostream>
  10. #include <boost/geometry.hpp>
  11. using namespace boost::geometry;
  12. int main()
  13. {
  14. typedef model::point<double, 2, cs::spherical_equatorial<degree> > degree_point;
  15. typedef model::point<double, 2, cs::spherical_equatorial<radian> > radian_point;
  16. degree_point d(4.893, 52.373);
  17. radian_point r(0.041, 0.8527);
  18. double dist = distance(d, r);
  19. std::cout
  20. << "distance:" << std::endl
  21. << dist << " over unit sphere" << std::endl
  22. << dist * 3959 << " over a spherical earth, in miles" << std::endl;
  23. return 0;
  24. }
  25. //]
  26. //[degree_radian_output
  27. /*`
  28. Output:
  29. [pre
  30. distance:
  31. 0.0675272 over unit sphere
  32. 267.34 over a spherical earth, in miles
  33. ]
  34. */
  35. //]