1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #ifndef BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
- #define BOOST_GEOMETRY_INDEX_DETAIL_ALGORITHMS_INTERSECTION_CONTENT_HPP
- #include <boost/geometry/algorithms/detail/disjoint/box_box.hpp>
- #include <boost/geometry/algorithms/detail/intersection/box_box_implementation.hpp>
- #include <boost/geometry/index/detail/algorithms/content.hpp>
- #include <boost/geometry/strategies/default_strategy.hpp>
- #include <boost/geometry/strategies/disjoint.hpp>
- namespace boost { namespace geometry { namespace index { namespace detail {
- template <typename Box, typename Strategy>
- inline bool disjoint_box_box(Box const& box1, Box const& box2, Strategy const& s)
- {
- return geometry::detail::disjoint::disjoint_box_box(box1, box2, s);
- }
- template <typename Box>
- inline bool disjoint_box_box(Box const& box1, Box const& box2, default_strategy const& )
- {
- typedef typename strategy::disjoint::services::default_strategy<Box, Box>::type strategy_type;
- return geometry::detail::disjoint::disjoint_box_box(box1, box2, strategy_type());
- }
- template <typename Box, typename Strategy>
- inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2, Strategy const& strategy)
- {
- bool const intersects = ! index::detail::disjoint_box_box(box1, box2, strategy);
-
-
-
- if ( intersects )
- {
- Box box_intersection;
- bool const ok = geometry::detail::intersection::intersection_box_box
- <
- 0, geometry::dimension<Box>::value
- >::apply(box1, box2, 0, box_intersection, 0);
- if ( ok )
- {
- return index::detail::content(box_intersection);
- }
- }
- return 0;
- }
- template <typename Box>
- inline typename default_content_result<Box>::type intersection_content(Box const& box1, Box const& box2)
- {
- return intersection_content(box1, box2, default_strategy());
- }
- }}}}
- #endif
|