1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
7 // This file was modified by Oracle on 2013-2017.
8 // Modifications copyright (c) 2013-2017, Oracle and/or its affiliates.
10 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
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)
20 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP
21 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP
26 #include <boost/geometry/algorithms/detail/intersects/interface.hpp>
27 #include <boost/geometry/algorithms/detail/disjoint/implementation.hpp>
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 #include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
34 #include <boost/geometry/strategies/relate.hpp>
37 namespace boost { namespace geometry
40 #ifndef DOXYGEN_NO_DETAIL
41 namespace detail { namespace intersects
44 template <typename Geometry>
45 struct self_intersects
47 static bool apply(Geometry const& geometry)
49 concepts::check<Geometry const>();
51 typedef typename geometry::point_type<Geometry>::type point_type;
52 typedef typename strategy::relate::services::default_strategy
55 >::type strategy_type;
56 typedef detail::no_rescale_policy rescale_policy_type;
58 typedef detail::overlay::turn_info
61 typename segment_ratio_type<point_type, rescale_policy_type>::type
64 std::deque<turn_info> turns;
66 typedef detail::overlay::get_turn_info
68 detail::overlay::assign_null_policy
71 strategy_type strategy;
72 rescale_policy_type robust_policy;
74 detail::disjoint::disjoint_interrupt_policy policy;
75 // TODO: skip_adjacent should be set to false
76 detail::self_get_turn_points::get_turns
79 >::apply(geometry, strategy, robust_policy, turns, policy, 0, true);
80 return policy.has_intersections;
84 }} // namespace detail::intersects
85 #endif // DOXYGEN_NO_DETAIL
87 }} // namespace boost::geometry
89 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP