1// Boost.Geometry Index
2//
3// boxes union/intersection area/volume
4//
5// Copyright (c) 2011-2014 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.hpp>
16#include <boost/geometry/index/detail/algorithms/content.hpp>
17
18namespace boost { namespace geometry { namespace index { namespace detail {
19
20/**
21 * \brief Compute the area of the intersection of b1 and b2
22 */
23template <typename Box>
24inline 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
38

source code of boost/boost/geometry/index/detail/algorithms/intersection_content.hpp