1 // Boost.Geometry (aka GGL, Generic Geometry Library) 2 3 // Copyright (c) 2007-2014 Barend Gehrels, Amsterdam, the Netherlands. 4 // Copyright (c) 2008-2014 Bruno Lalande, Paris, France. 5 // Copyright (c) 2009-2014 Mateusz Loskot, London, UK. 6 7 // This file was modified by Oracle on 2013-2017. 8 // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates. 9 10 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle 11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle 12 13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library 14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands. 15 16 // Use, modification and distribution is subject to the Boost Software License, 17 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 18 // http://www.boost.org/LICENSE_1_0.txt) 19 20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP 21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP 22 23 24 #include <deque> 25 26 #include <boost/geometry/algorithms/detail/intersects/interface.hpp> 27 #include <boost/geometry/algorithms/detail/disjoint/implementation.hpp> 28 29 #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp> 30 #include <boost/geometry/policies/disjoint_interrupt_policy.hpp> 31 #include <boost/geometry/policies/robustness/no_rescale_policy.hpp> 32 33 #include <boost/geometry/strategies/relate.hpp> 34 35 36 namespace boost { namespace geometry 37 { 38 39 #ifndef DOXYGEN_NO_DETAIL 40 namespace detail { namespace intersects 41 { 42 43 template <typename Geometry> 44 struct self_intersects 45 { applyboost::geometry::detail::intersects::self_intersects46 static bool apply(Geometry const& geometry) 47 { 48 concepts::check<Geometry const>(); 49 50 typedef typename geometry::point_type<Geometry>::type point_type; 51 typedef typename strategy::relate::services::default_strategy 52 < 53 Geometry, Geometry 54 >::type strategy_type; 55 56 typedef detail::overlay::turn_info<point_type> turn_info; 57 58 std::deque<turn_info> turns; 59 60 typedef detail::overlay::get_turn_info 61 < 62 detail::overlay::assign_null_policy 63 > turn_policy; 64 65 strategy_type strategy; 66 67 detail::disjoint::disjoint_interrupt_policy policy; 68 // TODO: skip_adjacent should be set to false 69 detail::self_get_turn_points::get_turns 70 < 71 false, turn_policy 72 >::apply(geometry, strategy, detail::no_rescale_policy(), turns, policy, 0, true); 73 return policy.has_intersections; 74 } 75 }; 76 77 }} // namespace detail::intersects 78 #endif // DOXYGEN_NO_DETAIL 79 80 }} // namespace boost::geometry 81 82 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP 83