Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:24

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2014-2016 Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0006 
0007 // Use, modification and distribution is subject to the Boost Software License,
0008 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0009 // http://www.boost.org/LICENSE_1_0.txt)
0010 
0011 #ifndef BOOST_GEOMETRY_FORMULAS_FLATTENING_HPP
0012 #define BOOST_GEOMETRY_FORMULAS_FLATTENING_HPP
0013 
0014 #include <boost/geometry/core/radius.hpp>
0015 #include <boost/geometry/core/tag.hpp>
0016 #include <boost/geometry/core/tags.hpp>
0017 
0018 #include <boost/geometry/algorithms/not_implemented.hpp>
0019 
0020 namespace boost { namespace geometry
0021 {
0022 
0023 #ifndef DOXYGEN_NO_DISPATCH
0024 namespace formula_dispatch
0025 {
0026 
0027 template <typename ResultType, typename Geometry, typename Tag = typename tag<Geometry>::type>
0028 struct flattening
0029     : not_implemented<Tag>
0030 {};
0031 
0032 template <typename ResultType, typename Geometry>
0033 struct flattening<ResultType, Geometry, srs_sphere_tag>
0034 {
0035     static inline ResultType apply(Geometry const& /*geometry*/)
0036     {
0037         return ResultType(0);
0038     }
0039 };
0040 
0041 template <typename ResultType, typename Geometry>
0042 struct flattening<ResultType, Geometry, srs_spheroid_tag>
0043 {
0044     static inline ResultType apply(Geometry const& geometry)
0045     {
0046         // (a - b) / a
0047         return ResultType(get_radius<0>(geometry) - get_radius<2>(geometry))
0048                     / ResultType(get_radius<0>(geometry));
0049     }
0050 };
0051 
0052 } // namespace formula_dispatch
0053 #endif // DOXYGEN_NO_DISPATCH
0054 
0055 #ifndef DOXYGEN_NO_DETAIL
0056 namespace formula
0057 {
0058 
0059 template <typename ResultType, typename Geometry>
0060 ResultType flattening(Geometry const& geometry)
0061 {
0062     return formula_dispatch::flattening<ResultType, Geometry>::apply(geometry);
0063 }
0064 
0065 } // namespace formula
0066 #endif // DOXYGEN_NO_DETAIL
0067 
0068 }} // namespace boost::geometry
0069 
0070 #endif // BOOST_GEOMETRY_FORMULAS_FLATTENING_HPP