Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

degree

Unit of plane angle: Degrees.

Description

Tag defining the unit of plane angle for spherical coordinate systems. This tag specifies that coordinates are defined in degrees (-180 .. 180). It has to be specified for some coordinate systems.

Synopsis

struct degree
{
  // ...
};

Header

Either

#include <boost/geometry.hpp>

Or

#include <boost/geometry/core/cs.hpp>

example

Specify two coordinate systems, one in degrees, one in radians.

#include <iostream>
#include <boost/geometry.hpp>

using namespace boost::geometry;

int main()
{
    typedef model::point<double, 2, cs::spherical_equatorial<degree> > degree_point;
    typedef model::point<double, 2, cs::spherical_equatorial<radian> > radian_point;

    degree_point d(4.893, 52.373);
    radian_point r(0.041, 0.8527);

    double dist = distance(d, r);
    std::cout
        << "distance:" << std::endl
        << dist << " over unit sphere" << std::endl
        << dist * 3959  << " over a spherical earth, in miles" << std::endl;

    return 0;
}

Output:

distance:
0.0675272 over unit sphere
267.34 over a spherical earth, in miles

PrevUpHomeNext