]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
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 | #include <boost/geometry/policies/robustness/segment_ratio_type.hpp> | |
33 | ||
34 | #include <boost/geometry/strategies/relate.hpp> | |
35 | ||
36 | ||
37 | namespace boost { namespace geometry | |
38 | { | |
39 | ||
40 | #ifndef DOXYGEN_NO_DETAIL | |
41 | namespace detail { namespace intersects | |
42 | { | |
43 | ||
44 | template <typename Geometry> | |
45 | struct self_intersects | |
46 | { | |
47 | static bool apply(Geometry const& geometry) | |
48 | { | |
49 | concepts::check<Geometry const>(); | |
50 | ||
51 | typedef typename geometry::point_type<Geometry>::type point_type; | |
52 | typedef typename strategy::relate::services::default_strategy | |
53 | < | |
54 | Geometry, Geometry | |
55 | >::type strategy_type; | |
56 | typedef detail::no_rescale_policy rescale_policy_type; | |
57 | ||
58 | typedef detail::overlay::turn_info | |
59 | < | |
60 | point_type, | |
61 | typename segment_ratio_type<point_type, rescale_policy_type>::type | |
62 | > turn_info; | |
63 | ||
64 | std::deque<turn_info> turns; | |
65 | ||
66 | typedef detail::overlay::get_turn_info | |
67 | < | |
68 | detail::overlay::assign_null_policy | |
69 | > turn_policy; | |
70 | ||
71 | strategy_type strategy; | |
72 | rescale_policy_type robust_policy; | |
73 | ||
74 | detail::disjoint::disjoint_interrupt_policy policy; | |
75 | // TODO: skip_adjacent should be set to false | |
76 | detail::self_get_turn_points::get_turns | |
77 | < | |
78 | false, turn_policy | |
79 | >::apply(geometry, strategy, robust_policy, turns, policy, 0, true); | |
80 | return policy.has_intersections; | |
81 | } | |
82 | }; | |
83 | ||
84 | }} // namespace detail::intersects | |
85 | #endif // DOXYGEN_NO_DETAIL | |
86 | ||
87 | }} // namespace boost::geometry | |
88 | ||
89 | #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_INTERSECTS_IMPLEMENTATION_HPP |