Chris@16: // Boost.Geometry (aka GGL, Generic Geometry Library) Chris@16: Chris@101: // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. Chris@101: // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. Chris@101: // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. Chris@101: Chris@101: // This file was modified by Oracle on 2013-2014. Chris@101: // Modifications copyright (c) 2013-2014, Oracle and/or its affiliates. Chris@101: Chris@101: // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle Chris@16: Chris@16: // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library Chris@16: // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. Chris@16: Chris@16: // Use, modification and distribution is subject to the Boost Software License, Chris@16: // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: Chris@16: #ifndef BOOST_GEOMETRY_ALGORITHMS_INTERSECTS_HPP Chris@16: #define BOOST_GEOMETRY_ALGORITHMS_INTERSECTS_HPP Chris@16: Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@101: #include Chris@101: #include Chris@101: Chris@16: Chris@16: namespace boost { namespace geometry Chris@16: { Chris@16: Chris@16: /*! Chris@16: \brief \brief_check{has at least one intersection (crossing or self-tangency)} Chris@16: \note This function can be called for one geometry (self-intersection) and Chris@16: also for two geometries (intersection) Chris@16: \ingroup intersects Chris@16: \tparam Geometry \tparam_geometry Chris@16: \param geometry \param_geometry Chris@16: \return \return_check{is self-intersecting} Chris@16: Chris@16: \qbk{distinguish,one geometry} Chris@16: \qbk{[def __one_parameter__]} Chris@16: \qbk{[include reference/algorithms/intersects.qbk]} Chris@16: */ Chris@16: template Chris@16: inline bool intersects(Geometry const& geometry) Chris@16: { Chris@16: concept::check(); Chris@16: Chris@101: typedef typename geometry::point_type::type point_type; Chris@101: typedef detail::no_rescale_policy rescale_policy_type; Chris@16: Chris@16: typedef detail::overlay::turn_info Chris@16: < Chris@101: point_type, Chris@101: typename segment_ratio_type::type Chris@16: > turn_info; Chris@101: Chris@16: std::deque turns; Chris@16: Chris@16: typedef detail::overlay::get_turn_info Chris@16: < Chris@16: detail::overlay::assign_null_policy Chris@101: > turn_policy; Chris@101: Chris@101: rescale_policy_type robust_policy; Chris@16: Chris@16: detail::disjoint::disjoint_interrupt_policy policy; Chris@16: detail::self_get_turn_points::get_turns Chris@101: < Chris@101: turn_policy Chris@101: >::apply(geometry, robust_policy, turns, policy); Chris@16: return policy.has_intersections; Chris@16: } Chris@16: Chris@16: Chris@16: /*! Chris@16: \brief \brief_check2{have at least one intersection} Chris@16: \ingroup intersects Chris@16: \tparam Geometry1 \tparam_geometry Chris@16: \tparam Geometry2 \tparam_geometry Chris@16: \param geometry1 \param_geometry Chris@16: \param geometry2 \param_geometry Chris@16: \return \return_check2{intersect each other} Chris@16: Chris@16: \qbk{distinguish,two geometries} Chris@16: \qbk{[include reference/algorithms/intersects.qbk]} Chris@16: */ Chris@16: template Chris@16: inline bool intersects(Geometry1 const& geometry1, Geometry2 const& geometry2) Chris@16: { Chris@16: concept::check(); Chris@16: concept::check(); Chris@16: Chris@16: return ! geometry::disjoint(geometry1, geometry2); Chris@16: } Chris@16: Chris@16: Chris@16: Chris@16: }} // namespace boost::geometry Chris@16: Chris@16: #endif // BOOST_GEOMETRY_ALGORITHMS_INTERSECTS_HPP