PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 4// Copyright (c) 2011 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
16using namespace boost::geometry;
17
18int 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/*`
40Output:
41[pre
42distance:
430.0675272 over unit sphere
44267.34 over a spherical earth, in miles
45]
46*/
47//]