summaryrefslogtreecommitdiff
path: root/boost/geometry/algorithms/detail/disjoint/point_box.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/geometry/algorithms/detail/disjoint/point_box.hpp')
-rw-r--r--boost/geometry/algorithms/detail/disjoint/point_box.hpp63
1 files changed, 22 insertions, 41 deletions
diff --git a/boost/geometry/algorithms/detail/disjoint/point_box.hpp b/boost/geometry/algorithms/detail/disjoint/point_box.hpp
index 73b7b70990..2f1085ada9 100644
--- a/boost/geometry/algorithms/detail/disjoint/point_box.hpp
+++ b/boost/geometry/algorithms/detail/disjoint/point_box.hpp
@@ -5,8 +5,8 @@
// Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
// Copyright (c) 2013-2015 Adam Wulkiewicz, Lodz, Poland
-// This file was modified by Oracle on 2013-2015.
-// Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2013-2016.
+// Modifications copyright (c) 2013-2016, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
// Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
@@ -28,6 +28,7 @@
#include <boost/geometry/core/tags.hpp>
#include <boost/geometry/algorithms/dispatch/disjoint.hpp>
+#include <boost/geometry/strategies/cartesian/point_in_box.hpp>
namespace boost { namespace geometry
{
@@ -37,49 +38,19 @@ namespace detail { namespace disjoint
{
-template
-<
- typename Point, typename Box,
- std::size_t Dimension, std::size_t DimensionCount
->
-struct point_box
-{
- static inline bool apply(Point const& point, Box const& box)
- {
- if (get<Dimension>(point) < get<min_corner, Dimension>(box)
- || get<Dimension>(point) > get<max_corner, Dimension>(box))
- {
- return true;
- }
- return point_box
- <
- Point, Box,
- Dimension + 1, DimensionCount
- >::apply(point, box);
- }
-};
-
-
-template <typename Point, typename Box, std::size_t DimensionCount>
-struct point_box<Point, Box, DimensionCount, DimensionCount>
-{
- static inline bool apply(Point const& , Box const& )
- {
- return false;
- }
-};
-
/*!
\brief Internal utility function to detect if point/box are disjoint
*/
template <typename Point, typename Box>
inline bool disjoint_point_box(Point const& point, Box const& box)
{
- return detail::disjoint::point_box
- <
- Point, Box,
- 0, dimension<Point>::type::value
- >::apply(point, box);
+ // ! covered_by(point, box)
+ return ! strategy::within::relate_point_box_loop
+ <
+ strategy::within::covered_by_range,
+ Point, Box,
+ 0, dimension<Point>::type::value
+ >::apply(point, box);
}
@@ -94,8 +65,18 @@ namespace dispatch
template <typename Point, typename Box, std::size_t DimensionCount>
struct disjoint<Point, Box, DimensionCount, point_tag, box_tag, false>
- : detail::disjoint::point_box<Point, Box, 0, DimensionCount>
-{};
+{
+ static inline bool apply(Point const& point, Box const& box)
+ {
+ // ! covered_by(point, box)
+ return ! strategy::within::relate_point_box_loop
+ <
+ strategy::within::covered_by_range,
+ Point, Box,
+ 0, DimensionCount
+ >::apply(point, box);
+ }
+};
} // namespace dispatch