File indexing completed on 2025-01-18 09:35:18
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_MAX_SIZE_HPP
0018 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_MAX_SIZE_HPP
0019
0020 #include <cstddef>
0021
0022 #include <boost/geometry/core/access.hpp>
0023 #include <boost/geometry/core/coordinate_dimension.hpp>
0024 #include <boost/geometry/util/math.hpp>
0025
0026 namespace boost { namespace geometry
0027 {
0028
0029 #ifndef DOXYGEN_NO_DETAIL
0030 namespace detail
0031 {
0032
0033 template <typename Box, std::size_t Dimension>
0034 struct get_max_size_box
0035 {
0036 static inline typename coordinate_type<Box>::type apply(Box const& box)
0037 {
0038 typename coordinate_type<Box>::type s
0039 = geometry::math::abs(geometry::get<1, Dimension>(box) - geometry::get<0, Dimension>(box));
0040
0041 return (std::max)(s, get_max_size_box<Box, Dimension - 1>::apply(box));
0042 }
0043 };
0044
0045 template <typename Box>
0046 struct get_max_size_box<Box, 0>
0047 {
0048 static inline typename coordinate_type<Box>::type apply(Box const& box)
0049 {
0050 return geometry::math::abs(geometry::get<1, 0>(box) - geometry::get<0, 0>(box));
0051 }
0052 };
0053
0054
0055
0056 template <typename Box>
0057 inline typename coordinate_type<Box>::type get_max_size(Box const& box)
0058 {
0059 return get_max_size_box<Box, dimension<Box>::value - 1>::apply(box);
0060 }
0061
0062 }
0063 #endif
0064
0065
0066 }}
0067
0068
0069 #endif