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_ECCENCRICITY_SQR_HPP
0012 #define BOOST_GEOMETRY_FORMULAS_ECCENCRICITY_SQR_HPP
0013
0014 #include <boost/geometry/algorithms/not_implemented.hpp>
0015
0016 #include <boost/geometry/core/radius.hpp>
0017 #include <boost/geometry/core/tag.hpp>
0018 #include <boost/geometry/core/tags.hpp>
0019
0020 #include <boost/geometry/util/math.hpp>
0021
0022 namespace boost { namespace geometry
0023 {
0024
0025 #ifndef DOXYGEN_NO_DISPATCH
0026 namespace formula_dispatch
0027 {
0028
0029 template <typename ResultType, typename Geometry, typename Tag = typename tag<Geometry>::type>
0030 struct eccentricity_sqr
0031 : not_implemented<Tag>
0032 {};
0033
0034 template <typename ResultType, typename Geometry>
0035 struct eccentricity_sqr<ResultType, Geometry, srs_sphere_tag>
0036 {
0037 static inline ResultType apply(Geometry const& )
0038 {
0039 return ResultType(0);
0040 }
0041 };
0042
0043 template <typename ResultType, typename Geometry>
0044 struct eccentricity_sqr<ResultType, Geometry, srs_spheroid_tag>
0045 {
0046 static inline ResultType apply(Geometry const& geometry)
0047 {
0048
0049 return ResultType(1) - math::sqr(ResultType(get_radius<2>(geometry))
0050 / ResultType(get_radius<0>(geometry)));
0051 }
0052 };
0053
0054 }
0055 #endif
0056
0057 #ifndef DOXYGEN_NO_DETAIL
0058 namespace formula
0059 {
0060
0061 template <typename ResultType, typename Geometry>
0062 ResultType eccentricity_sqr(Geometry const& geometry)
0063 {
0064 return formula_dispatch::eccentricity_sqr<ResultType, Geometry>::apply(geometry);
0065 }
0066
0067 }
0068 #endif
0069
0070 }}
0071
0072 #endif