File indexing completed on 2025-01-18 09:35:25
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef BOOST_GEOMETRY_FORMULAS_MEAN_RADIUS_HPP
0012 #define BOOST_GEOMETRY_FORMULAS_MEAN_RADIUS_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 mean_radius
0029 : not_implemented<Tag>
0030 {};
0031
0032 template <typename ResultType, typename Geometry>
0033 struct mean_radius<ResultType, Geometry, srs_sphere_tag>
0034 {
0035 static inline ResultType apply(Geometry const& geometry)
0036 {
0037 return ResultType(get_radius<0>(geometry));
0038 }
0039 };
0040
0041 template <typename ResultType, typename Geometry>
0042 struct mean_radius<ResultType, Geometry, srs_spheroid_tag>
0043 {
0044 static inline ResultType apply(Geometry const& geometry)
0045 {
0046
0047 return (ResultType(2) * ResultType(get_radius<0>(geometry))
0048 + ResultType(get_radius<2>(geometry)))
0049 / ResultType(3);
0050 }
0051 };
0052
0053 }
0054 #endif
0055
0056 #ifndef DOXYGEN_NO_DETAIL
0057 namespace formula
0058 {
0059
0060 template <typename ResultType, typename Geometry>
0061 inline ResultType mean_radius(Geometry const& geometry)
0062 {
0063 return formula_dispatch::mean_radius<ResultType, Geometry>::apply(geometry);
0064 }
0065
0066 }
0067 #endif
0068
0069 }}
0070
0071 #endif