box_box.hpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
  4. // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
  5. // Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland.
  6. // This file was modified by Oracle on 2013-2021.
  7. // Modifications copyright (c) 2013-2021, Oracle and/or its affiliates.
  8. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  9. // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
  10. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  11. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  12. // Use, modification and distribution is subject to the Boost Software License,
  13. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  14. // http://www.boost.org/LICENSE_1_0.txt)
  15. #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_BOX_BOX_HPP
  16. #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_BOX_BOX_HPP
  17. #include <cstddef>
  18. #include <boost/geometry/algorithms/dispatch/disjoint.hpp>
  19. #include <boost/geometry/strategies/detail.hpp>
  20. namespace boost { namespace geometry
  21. {
  22. #ifndef DOXYGEN_NO_DETAIL
  23. namespace detail { namespace disjoint
  24. {
  25. /*!
  26. \brief Internal utility function to detect if boxes are disjoint
  27. \note Is used from other algorithms, declared separately
  28. to avoid circular references
  29. */
  30. template
  31. <
  32. typename Box1, typename Box2, typename Strategy,
  33. std::enable_if_t<strategies::detail::is_umbrella_strategy<Strategy>::value, int> = 0
  34. >
  35. inline bool disjoint_box_box(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
  36. {
  37. typedef decltype(strategy.disjoint(box1, box2)) strategy_type;
  38. return strategy_type::apply(box1, box2);
  39. }
  40. template
  41. <
  42. typename Box1, typename Box2, typename Strategy,
  43. std::enable_if_t<! strategies::detail::is_umbrella_strategy<Strategy>::value, int> = 0
  44. >
  45. inline bool disjoint_box_box(Box1 const& box1, Box2 const& box2, Strategy const& )
  46. {
  47. return Strategy::apply(box1, box2);
  48. }
  49. }} // namespace detail::disjoint
  50. #endif // DOXYGEN_NO_DETAIL
  51. #ifndef DOXYGEN_NO_DISPATCH
  52. namespace dispatch
  53. {
  54. template <typename Box1, typename Box2, std::size_t DimensionCount>
  55. struct disjoint<Box1, Box2, DimensionCount, box_tag, box_tag, false>
  56. {
  57. template <typename Strategy>
  58. static inline bool apply(Box1 const& box1, Box2 const& box2, Strategy const& strategy)
  59. {
  60. typedef decltype(strategy.disjoint(box1, box2)) strategy_type;
  61. return strategy_type::apply(box1, box2);
  62. }
  63. };
  64. } // namespace dispatch
  65. #endif // DOXYGEN_NO_DISPATCH
  66. }} // namespace boost::geometry
  67. #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_DISJOINT_BOX_BOX_HPP