]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry Index |
2 | // | |
3 | // boxes union/intersection area/volume | |
4 | // | |
5 | // Copyright (c) 2011-2016 Adam Wulkiewicz, Lodz, Poland. | |
6 | // | |
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) | |
10 | ||
11 | #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP | |
12 | #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP | |
13 | ||
14 | #include <boost/geometry/algorithms/intersection.hpp> | |
15 | #include <boost/geometry/strategies/intersection_strategies.hpp> | |
16 | #include <boost/geometry/index/detail/algorithms/content.hpp> | |
17 | ||
18 | namespace boost { namespace geometry { namespace index { namespace detail { | |
19 | ||
20 | /** | |
21 | * \brief Compute the area of the intersection of b1 and b2 | |
22 | */ | |
23 | template <typename Box> | |
24 | inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2) | |
25 | { | |
26 | if ( geometry::intersects(box1, box2) ) | |
27 | { | |
28 | Box box_intersection; | |
29 | if ( geometry::intersection(box1, box2, box_intersection) ) | |
30 | return detail::content(box_intersection); | |
31 | } | |
32 | return 0; | |
33 | } | |
34 | ||
35 | }}}} // namespace boost::geometry::index::detail | |
36 | ||
37 | #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP |