union_content.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. // Boost.Geometry Index
  2. //
  3. // boxes union/sum area/volume
  4. //
  5. // Copyright (c) 2008 Federico J. Fernandez.
  6. // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
  7. //
  8. // Use, modification and distribution is subject to the Boost Software License,
  9. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP
  12. #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP
  13. #include <boost/geometry/algorithms/expand.hpp>
  14. #include <boost/geometry/index/detail/algorithms/content.hpp>
  15. namespace boost { namespace geometry { namespace index { namespace detail {
  16. /**
  17. * \brief Compute the area of the union of b1 and b2
  18. */
  19. template <typename Box, typename Geometry>
  20. inline typename default_content_result<Box>::type union_content(Box const& b, Geometry const& g)
  21. {
  22. Box expanded_box(b);
  23. geometry::expand(expanded_box, g);
  24. return detail::content(expanded_box);
  25. }
  26. }}}} // namespace boost::geometry::index::detail
  27. #endif // BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_UNION_CONTENT_HPP