1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2014, Oracle and/or its affiliates.
5 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
10 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_HAS_VALID_SELF_TURNS_HPP
11 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_HAS_VALID_SELF_TURNS_HPP
13 #include <boost/geometry/core/point_type.hpp>
15 #include <boost/geometry/policies/predicate_based_interrupt_policy.hpp>
16 #include <boost/geometry/policies/robustness/segment_ratio_type.hpp>
17 #include <boost/geometry/policies/robustness/get_rescale_policy.hpp>
19 #include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
20 #include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
21 #include <boost/geometry/algorithms/detail/overlay/self_turn_points.hpp>
23 #include <boost/geometry/algorithms/detail/is_valid/is_acceptable_turn.hpp>
26 namespace boost { namespace geometry
30 #ifndef DOXYGEN_NO_DETAIL
31 namespace detail { namespace is_valid
38 typename IsAcceptableTurn = is_acceptable_turn<Geometry>
40 class has_valid_self_turns
43 typedef typename point_type<Geometry>::type point_type;
45 typedef typename geometry::rescale_policy_type
48 >::type rescale_policy_type;
50 typedef detail::overlay::get_turn_info
52 detail::overlay::assign_null_policy
56 typedef detail::overlay::turn_info
59 typename geometry::segment_ratio_type
66 // returns true if all turns are valid
67 template <typename Turns>
68 static inline bool apply(Geometry const& geometry, Turns& turns)
70 rescale_policy_type robust_policy
71 = geometry::get_rescale_policy<rescale_policy_type>(geometry);
73 detail::overlay::stateless_predicate_based_interrupt_policy
78 geometry::self_turns<turn_policy>(geometry,
83 return !interrupt_policy.has_intersections;
88 }} // namespace detail::is_valid
89 #endif // DOXYGEN_NO_DETAIL
91 }} // namespace boost::geometry
93 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_IS_VALID_HAS_VALID_SELF_TURNS_HPP