File indexing completed on 2025-01-18 09:35:24
0001
0002
0003
0004
0005
0006
0007
0008
0009
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& )
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
0047 return ResultType(get_radius<0>(geometry) - get_radius<2>(geometry))
0048 / ResultType(get_radius<0>(geometry));
0049 }
0050 };
0051
0052 }
0053 #endif
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 }
0066 #endif
0067
0068 }}
0069
0070 #endif