• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // QuickBook Example
3 
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 
10 //[degree_radian
11 //` Specify two coordinate systems, one in degrees, one in radians.
12 
13 #include <iostream>
14 #include <boost/geometry.hpp>
15 
16 using namespace boost::geometry;
17 
main()18 int main()
19 {
20     typedef model::point<double, 2, cs::spherical_equatorial<degree> > degree_point;
21     typedef model::point<double, 2, cs::spherical_equatorial<radian> > radian_point;
22 
23     degree_point d(4.893, 52.373);
24     radian_point r(0.041, 0.8527);
25 
26     double dist = distance(d, r);
27     std::cout
28         << "distance:" << std::endl
29         << dist << " over unit sphere" << std::endl
30         << dist * 3959  << " over a spherical earth, in miles" << std::endl;
31 
32     return 0;
33 }
34 
35 //]
36 
37 
38 //[degree_radian_output
39 /*`
40 Output:
41 [pre
42 distance:
43 0.0675272 over unit sphere
44 267.34 over a spherical earth, in miles
45 ]
46 */
47 //]
48