summaryrefslogtreecommitdiff log msg author committer range
diff options
 context: 12345678910152025303540 space: includeignore mode: unifiedssdiffstat only
Diffstat (limited to 'boost/geometry/algorithms/overlaps.hpp')
-rw-r--r--boost/geometry/algorithms/overlaps.hpp210
1 files changed, 2 insertions, 208 deletions
 diff --git a/boost/geometry/algorithms/overlaps.hpp b/boost/geometry/algorithms/overlaps.hppindex bedf17599b..869a85ca98 100644--- a/boost/geometry/algorithms/overlaps.hpp+++ b/boost/geometry/algorithms/overlaps.hpp@@ -20,214 +20,8 @@ #define BOOST_GEOMETRY_ALGORITHMS_OVERLAPS_HPP -#include +#include +#include -#include --#include --#include --#include -#include ---namespace boost { namespace geometry-{--#ifndef DOXYGEN_NO_DETAIL-namespace detail { namespace overlaps-{--template-<- std::size_t Dimension,- std::size_t DimensionCount->-struct box_box_loop-{- template - static inline void apply(Box1 const& b1, Box2 const& b2,- bool& overlaps, bool& one_in_two, bool& two_in_one)- {- assert_dimension_equal();-- typedef typename coordinate_type::type coordinate_type1;- typedef typename coordinate_type::type coordinate_type2;-- coordinate_type1 const& min1 = get(b1);- coordinate_type1 const& max1 = get(b1);- coordinate_type2 const& min2 = get(b2);- coordinate_type2 const& max2 = get(b2);-- // We might use the (not yet accepted) Boost.Interval- // submission in the future-- // If:- // B1: |-------|- // B2: |------|- // in any dimension -> no overlap- if (max1 <= min2 || min1 >= max2)- {- overlaps = false;- return;- }-- // If:- // B1: |--------------------|- // B2: |-------------|- // in all dimensions -> within, then no overlap- // B1: |--------------------|- // B2: |-------------|- // this is "within-touch" -> then no overlap. So use < and >- if (min1 < min2 || max1 > max2)- {- one_in_two = false;- }-- // Same other way round- if (min2 < min1 || max2 > max1)- {- two_in_one = false;- }-- box_box_loop- <- Dimension + 1,- DimensionCount- >::apply(b1, b2, overlaps, one_in_two, two_in_one);- }-};--template-<- std::size_t DimensionCount->-struct box_box_loop-{- template - static inline void apply(Box1 const& , Box2 const&, bool&, bool&, bool&)- {- }-};--struct box_box-{- template - static inline bool apply(Box1 const& b1, Box2 const& b2, Strategy const& /*strategy*/)- {- bool overlaps = true;- bool within1 = true;- bool within2 = true;- box_box_loop- <- 0,- dimension::type::value- >::apply(b1, b2, overlaps, within1, within2);-- /*- \see http://docs.codehaus.org/display/GEOTDOC/02+Geometry+Relationships#02GeometryRelationships-Overlaps- where is stated that "inside" is not an "overlap",- this is true and is implemented as such.- */- return overlaps && ! within1 && ! within2;- }-};--}} // namespace detail::overlaps-#endif // DOXYGEN_NO_DETAIL---#ifndef DOXYGEN_NO_DISPATCH-namespace dispatch-{---template-<- typename Geometry1,- typename Geometry2,- typename Tag1 = typename tag::type,- typename Tag2 = typename tag::type->-struct overlaps- : detail::relate::relate_impl- <- detail::de9im::static_mask_overlaps_type,- Geometry1,- Geometry2- >-{};---template -struct overlaps- : detail::overlaps::box_box-{};--} // namespace dispatch-#endif // DOXYGEN_NO_DISPATCH---/*!-\brief \brief_check2{overlap}-\ingroup overlaps-\tparam Geometry1 \tparam_geometry-\tparam Geometry2 \tparam_geometry-\tparam Strategy \tparam_strategy{Overlaps}-\param geometry1 \param_geometry-\param geometry2 \param_geometry-\param strategy \param_strategy{overlaps}-\return \return_check2{overlap}--\qbk{distinguish,with strategy}-\qbk{[include reference/algorithms/overlaps.qbk]}-*/-template -inline bool overlaps(Geometry1 const& geometry1,- Geometry2 const& geometry2,- Strategy const& strategy)-{- concepts::check();- concepts::check();-- return dispatch::overlaps- <- Geometry1,- Geometry2- >::apply(geometry1, geometry2, strategy);-}--/*!-\brief \brief_check2{overlap}-\ingroup overlaps-\tparam Geometry1 \tparam_geometry-\tparam Geometry2 \tparam_geometry-\param geometry1 \param_geometry-\param geometry2 \param_geometry-\return \return_check2{overlap}--\qbk{[include reference/algorithms/overlaps.qbk]}-*/-template -inline bool overlaps(Geometry1 const& geometry1, Geometry2 const& geometry2)-{- concepts::check();- concepts::check();-- typedef typename strategy::relate::services::default_strategy- <- Geometry1,- Geometry2- >::type strategy_type;-- return dispatch::overlaps- <- Geometry1,- Geometry2- >::apply(geometry1, geometry2, strategy_type());-}--}} // namespace boost::geometry #endif // BOOST_GEOMETRY_ALGORITHMS_OVERLAPS_HPP