File indexing completed on 2025-09-18 08:43:12
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
0017 #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
0018
0019 #include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
0020 #include <boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp>
0021
0022 #include <boost/geometry/index/detail/algorithms/content.hpp>
0023
0024 #include <boost/geometry/strategies/default_strategy.hpp>
0025 #include <boost/geometry/strategies/disjoint.hpp>
0026
0027 namespace boost { namespace geometry { namespace index { namespace detail {
0028
0029
0030 template <typename Box, typename Strategy>
0031 inline bool disjoint_box_box(Box const& box1, Box const& box2, Strategy const& s)
0032 {
0033 return geometry::detail::disjoint::disjoint_box_box(box1, box2, s);
0034 }
0035
0036 template <typename Box>
0037 inline bool disjoint_box_box(Box const& box1, Box const& box2, default_strategy const& )
0038 {
0039 typedef typename strategy::disjoint::services::default_strategy<Box, Box>::type strategy_type;
0040 return geometry::detail::disjoint::disjoint_box_box(box1, box2, strategy_type());
0041 }
0042
0043
0044
0045
0046 template <typename Box, typename Strategy>
0047 inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2, Strategy const& strategy)
0048 {
0049 bool const intersects = ! index::detail::disjoint_box_box(box1, box2, strategy);
0050
0051
0052
0053
0054
0055 if ( intersects )
0056 {
0057 Box box_intersection;
0058 bool const ok = geometry::detail::intersection::intersection_box_box
0059 <
0060 0, geometry::dimension<Box>::value
0061 >::apply(box1, box2, box_intersection, 0);
0062 if ( ok )
0063 {
0064 return index::detail::content(box_intersection);
0065 }
0066 }
0067 return 0;
0068 }
0069
0070 template <typename Box>
0071 inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2)
0072 {
0073 return intersection_content(box1, box2, default_strategy());
0074 }
0075
0076 }}}}
0077
0078 #endif