3 // Copyright (c) 2014-2016 Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_FORMULAS_FLATTENING_HPP
12 #define BOOST_GEOMETRY_FORMULAS_FLATTENING_HPP
14 #include <boost/geometry/core/radius.hpp>
15 #include <boost/geometry/core/tag.hpp>
16 #include <boost/geometry/core/tags.hpp>
18 #include <boost/geometry/algorithms/not_implemented.hpp>
20 namespace boost { namespace geometry
23 #ifndef DOXYGEN_NO_DISPATCH
24 namespace formula_dispatch
27 template <typename ResultType, typename Geometry, typename Tag = typename tag<Geometry>::type>
29 : not_implemented<Tag>
32 template <typename ResultType, typename Geometry>
33 struct flattening<ResultType, Geometry, srs_sphere_tag>
35 static inline ResultType apply(Geometry const& /*geometry*/)
41 template <typename ResultType, typename Geometry>
42 struct flattening<ResultType, Geometry, srs_spheroid_tag>
44 static inline ResultType apply(Geometry const& geometry)
47 return ResultType(get_radius<0>(geometry) - get_radius<2>(geometry))
48 / ResultType(get_radius<0>(geometry));
52 } // namespace formula_dispatch
53 #endif // DOXYGEN_NO_DISPATCH
55 #ifndef DOXYGEN_NO_DETAIL
59 template <typename ResultType, typename Geometry>
60 ResultType flattening(Geometry const& geometry)
62 return formula_dispatch::flattening<ResultType, Geometry>::apply(geometry);
65 } // namespace formula
66 #endif // DOXYGEN_NO_DETAIL
68 }} // namespace boost::geometry
70 #endif // BOOST_GEOMETRY_FORMULAS_FLATTENING_HPP