Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2014 Barend Gehrels, Amsterdam, the Netherlands.
0004 // Copyright (c) 2014 Bruno Lalande, Paris, France.
0005 // Copyright (c) 2014 Mateusz Loskot, London, UK.
0006 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
0007 
0008 // This file was modified by Oracle on 2018.
0009 // Modifications copyright (c) 2018, Oracle and/or its affiliates.
0010 
0011 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0012 
0013 // Use, modification and distribution is subject to the Boost Software License,
0014 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0015 // http://www.boost.org/LICENSE_1_0.txt)
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 // This might be implemented later on for other geometries too.
0055 // Not dispatched yet.
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 } // namespace detail
0063 #endif // DOXYGEN_NO_DETAIL
0064 
0065 
0066 }} // namespace boost::geometry
0067 
0068 
0069 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_GET_MAX_SIZE_HPP