1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2015, Oracle and/or its affiliates.
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7 // Distributed under the Boost Software License, Version 1.0.
8 // (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INITIALIZE_HPP
12 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INITIALIZE_HPP
16 #include <boost/numeric/conversion/bounds.hpp>
18 #include <boost/geometry/core/access.hpp>
19 #include <boost/geometry/core/coordinate_dimension.hpp>
20 #include <boost/geometry/core/coordinate_type.hpp>
23 namespace boost { namespace geometry
26 #ifndef DOXYGEN_NO_DETAIL
27 namespace detail { namespace envelope
30 template <std::size_t Dimension, std::size_t DimensionCount>
31 struct initialize_loop
33 template <typename Box, typename CoordinateType>
34 static inline void apply(Box& box,
35 CoordinateType min_value,
36 CoordinateType max_value)
38 geometry::set<min_corner, Dimension>(box, min_value);
39 geometry::set<max_corner, Dimension>(box, max_value);
43 Dimension + 1, DimensionCount
44 >::apply(box, min_value, max_value);
48 template <std::size_t DimensionCount>
49 struct initialize_loop<DimensionCount, DimensionCount>
51 template <typename Box, typename CoordinateType>
52 static inline void apply(Box&, CoordinateType, CoordinateType)
61 std::size_t Dimension = 0,
62 std::size_t DimensionCount = dimension<Box>::value
66 typedef typename coordinate_type<Box>::type coordinate_type;
68 static inline void apply(Box& box,
69 coordinate_type min_value
70 = boost::numeric::bounds<coordinate_type>::highest(),
71 coordinate_type max_value
72 = boost::numeric::bounds<coordinate_type>::lowest())
76 Dimension, DimensionCount
77 >::apply(box, min_value, max_value);
81 }} // namespace detail::envelope
82 #endif // DOXYGEN_NO_DETAIL
84 }} // namespace boost::geometry
86 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_ENVELOPE_INITIALIZE_HPP