// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFER_BOX_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFER_BOX_HPP #include #include #include #include namespace boost { namespace geometry { #ifndef DOXYGEN_NO_DETAIL namespace detail { namespace buffer { template struct box_loop { typedef typename coordinate_type::type coordinate_type; static inline void apply(BoxIn const& box_in, T const& distance, BoxOut& box_out) { coordinate_type d = distance; set(box_out, get(box_in) + d); box_loop::apply(box_in, distance, box_out); } }; template struct box_loop { static inline void apply(BoxIn const&, T const&, BoxOut&) {} }; // Extends a box with the same amount in all directions template inline void buffer_box(BoxIn const& box_in, T const& distance, BoxOut& box_out) { assert_dimension_equal(); static const std::size_t N = dimension::value; box_loop::apply(box_in, -distance, box_out); box_loop::apply(box_in, distance, box_out); } }} // namespace detail::buffer #endif // DOXYGEN_NO_DETAIL }} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_BUFFER_BUFFER_BOX_HPP