1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands. 4 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France. 5 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK. 6 // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland. 7 8 // This file was modified by Oracle on 2013-2018. 9 // Modifications copyright (c) 2013-2018, Oracle and/or its affiliates. 10 11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 12 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle 13 14 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 15 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 16 17 // Use, modification and distribution is subject to the Boost Software License, 18 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 19 // http://www.boost.org/LICENSE_1_0.txt) 20 21 #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISJOINT_BOX_BOX_HPP 22 #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISJOINT_BOX_BOX_HPP 23 24 #include <cstddef> 25 26 #include <boost/geometry/core/access.hpp> 27 #include <boost/geometry/core/coordinate_dimension.hpp> 28 #include <boost/geometry/core/tags.hpp> 29 30 #include <boost/geometry/strategies/disjoint.hpp> 31 32 33 namespace boost { namespace geometry { namespace strategy { namespace disjoint 34 { 35 36 #ifndef DOXYGEN_NO_DETAIL 37 namespace detail 38 { 39 40 template 41 < 42 typename Box1, typename Box2, 43 std::size_t Dimension = 0, 44 std::size_t DimensionCount = dimension<Box1>::value 45 > 46 struct box_box 47 { applyboost::geometry::strategy::disjoint::detail::box_box48 static inline bool apply(Box1 const& box1, Box2 const& box2) 49 { 50 if (get<max_corner, Dimension>(box1) < get<min_corner, Dimension>(box2)) 51 { 52 return true; 53 } 54 if (get<min_corner, Dimension>(box1) > get<max_corner, Dimension>(box2)) 55 { 56 return true; 57 } 58 return box_box 59 < 60 Box1, Box2, 61 Dimension + 1, DimensionCount 62 >::apply(box1, box2); 63 } 64 }; 65 66 67 template <typename Box1, typename Box2, std::size_t DimensionCount> 68 struct box_box<Box1, Box2, DimensionCount, DimensionCount> 69 { applyboost::geometry::strategy::disjoint::detail::box_box70 static inline bool apply(Box1 const& , Box2 const& ) 71 { 72 return false; 73 } 74 }; 75 76 } // namespace detail 77 #endif // DOXYGEN_NO_DETAIL 78 79 80 struct cartesian_box_box 81 { 82 template <typename Box1, typename Box2> applyboost::geometry::strategy::disjoint::cartesian_box_box83 static inline bool apply(Box1 const& box1, Box2 const& box2) 84 { 85 return detail::box_box<Box1, Box2>::apply(box1, box2); 86 } 87 }; 88 89 90 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 91 92 93 namespace services 94 { 95 96 template <typename Box1, typename Box2, int TopDim1, int TopDim2> 97 struct default_strategy<Box1, Box2, box_tag, box_tag, TopDim1, TopDim2, cartesian_tag, cartesian_tag> 98 { 99 typedef disjoint::cartesian_box_box type; 100 }; 101 102 103 } // namespace services 104 105 106 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS 107 108 109 }}}} // namespace boost::geometry::strategy::disjoint 110 111 112 #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DISJOINT_BOX_BOX_HPP 113