1 // Boost.Geometry Index
3 // boxes union/intersection area/volume
5 // Copyright (c) 2011-2017 Adam Wulkiewicz, Lodz, Poland.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
12 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
14 #include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
15 #include <boost/geometry/algorithms/detail/overlay/intersection_box_box.hpp>
17 #include <boost/geometry/index/detail/algorithms/content.hpp>
19 namespace boost { namespace geometry { namespace index { namespace detail {
22 * \brief Compute the area of the intersection of b1 and b2
24 template <typename Box>
25 inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2)
27 bool const intersects = ! geometry::detail::disjoint::box_box<Box, Box>::apply(box1, box2);
32 bool const ok = geometry::detail::intersection::intersection_box_box
34 0, geometry::dimension<Box>::value
35 >::apply(box1, box2, 0, box_intersection, 0);
38 return index::detail::content(box_intersection);
44 }}}} // namespace boost::geometry::index::detail
46 #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP