1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
5 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
8 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
14 #ifndef BOOST_GEOMETRY_CORE_CS_HPP
15 #define BOOST_GEOMETRY_CORE_CS_HPP
19 #include <boost/type_traits.hpp>
21 #include <boost/geometry/core/coordinate_system.hpp>
22 #include <boost/geometry/core/tags.hpp>
25 namespace boost { namespace geometry
29 \brief Unit of plane angle: Degrees
30 \details Tag defining the unit of plane angle for spherical coordinate systems.
31 This tag specifies that coordinates are defined in degrees (-180 .. 180).
32 It has to be specified for some coordinate systems.
33 \qbk{[include reference/core/degree_radian.qbk]}
39 \brief Unit of plane angle: Radians
40 \details Tag defining the unit of plane angle for spherical coordinate systems.
41 This tag specifies that coordinates are defined in radians (-PI .. PI).
42 It has to be specified for some coordinate systems.
43 \qbk{[include reference/core/degree_radian.qbk]}
52 \brief Cartesian coordinate system
53 \details Defines the Cartesian or rectangular coordinate system
54 where points are defined in 2 or 3 (or more)
55 dimensions and usually (but not always) known as x,y,z
56 \see http://en.wikipedia.org/wiki/Cartesian_coordinate_system
65 \brief Geographic coordinate system, in degree or in radian
66 \details Defines the geographic coordinate system where points
67 are defined in two angles and usually
68 known as lat,long or lo,la or phi,lambda
69 \see http://en.wikipedia.org/wiki/Geographic_coordinate_system
71 \note might be moved to extensions/gis/geographic
73 template<typename DegreeOrRadian>
76 typedef DegreeOrRadian units;
82 \brief Spherical (polar) coordinate system, in degree or in radian
83 \details Defines the spherical coordinate system where points are
85 and an optional radius usually known as r, theta, phi
88 0 <= phi < 2pi is the angle between the positive x-axis and the
89 line from the origin to the P projected onto the xy-plane.
91 0 <= theta <= pi is the angle between the positive z-axis and the
92 line formed between the origin and P.
93 - coordinate 2 (if specified):
94 r >= 0 is the distance from the origin to a given point P.
96 \see http://en.wikipedia.org/wiki/Spherical_coordinates
99 template<typename DegreeOrRadian>
102 typedef DegreeOrRadian units;
107 \brief Spherical equatorial coordinate system, in degree or in radian
108 \details This one resembles the geographic coordinate system, and has latitude
109 up from zero at the equator, to 90 at the pole
110 (opposite to the spherical(polar) coordinate system).
111 Used in astronomy and in GIS (but there is also the geographic)
113 \see http://en.wikipedia.org/wiki/Spherical_coordinates
116 template<typename DegreeOrRadian>
117 struct spherical_equatorial
119 typedef DegreeOrRadian units;
125 \brief Polar coordinate system
126 \details Defines the polar coordinate system "in which each point
127 on a plane is determined by an angle and a distance"
128 \see http://en.wikipedia.org/wiki/Polar_coordinates
131 template<typename DegreeOrRadian>
134 typedef DegreeOrRadian units;
145 \brief Traits class defining coordinate system tag, bound to coordinate system
147 \tparam CoordinateSystem coordinate system
149 template <typename CoordinateSystem>
155 #ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
157 template<typename DegreeOrRadian>
158 struct cs_tag<cs::geographic<DegreeOrRadian> >
160 typedef geographic_tag type;
163 template<typename DegreeOrRadian>
164 struct cs_tag<cs::spherical<DegreeOrRadian> >
166 typedef spherical_polar_tag type;
169 template<typename DegreeOrRadian>
170 struct cs_tag<cs::spherical_equatorial<DegreeOrRadian> >
172 typedef spherical_equatorial_tag type;
177 struct cs_tag<cs::cartesian>
179 typedef cartesian_tag type;
183 #endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
184 } // namespace traits
187 \brief Meta-function returning coordinate system tag (cs family) of any geometry
190 template <typename G>
193 typedef typename traits::cs_tag
195 typename geometry::coordinate_system<G>::type
201 \brief Meta-function to verify if a coordinate system is radian
204 template <typename CoordinateSystem>
205 struct is_radian : boost::true_type {};
208 #ifndef DOXYGEN_NO_SPECIALIZATIONS
210 // Specialization for any degree coordinate systems
211 template <template<typename> class CoordinateSystem>
212 struct is_radian< CoordinateSystem<degree> > : boost::false_type
216 #endif // DOXYGEN_NO_SPECIALIZATIONS
218 }} // namespace boost::geometry
220 #endif // BOOST_GEOMETRY_CORE_CS_HPP