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