1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2017.
6 // Modifications copyright (c) 2017 Oracle and/or its affiliates.
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
14 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
15 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
20 #include <boost/mpl/if.hpp>
21 #include <boost/range.hpp>
23 #include <boost/geometry/algorithms/convert.hpp>
24 #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
25 #include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
27 #include <boost/geometry/geometries/segment.hpp>
29 namespace boost { namespace geometry
33 #ifndef DOXYGEN_NO_DETAIL
34 namespace detail { namespace get_intersection_points
44 struct get_turn_without_info
48 typename UniqueSubRange1,
49 typename UniqueSubRange2,
51 typename RobustPolicy,
52 typename OutputIterator
54 static inline OutputIterator apply(UniqueSubRange1 const& range_p,
55 UniqueSubRange2 const& range_q,
57 Strategy const& strategy,
61 // Make sure this is only called with no rescaling
62 BOOST_STATIC_ASSERT((boost::is_same
64 no_rescale_policy_tag,
65 typename rescale_policy_type<RobustPolicy>::type
68 typedef typename TurnInfo::point_type turn_point_type;
70 typedef policies::relate::segments_intersection_points
72 segment_intersection_points<turn_point_type>
75 typename policy_type::return_type const result
76 = strategy.apply(range_p, range_q, policy_type());
78 for (std::size_t i = 0; i < result.count; i++)
81 geometry::convert(result.intersections[i], tp.point);
89 }} // namespace detail::get_intersection_points
90 #endif // DOXYGEN_NO_DETAIL
99 typename RobustPolicy,
103 inline void get_intersection_points(Geometry1 const& geometry1,
104 Geometry2 const& geometry2,
105 RobustPolicy const& robust_policy,
107 Strategy const& strategy)
109 concepts::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2 const>();
111 typedef detail::get_intersection_points::get_turn_without_info
113 typename point_type<Geometry1>::type,
114 typename point_type<Geometry2>::type,
115 typename boost::range_value<Turns>::type
118 detail::get_turns::no_interrupt_policy interrupt_policy;
122 reverse_dispatch<Geometry1, Geometry2>::type::value,
123 dispatch::get_turns_reversed
125 typename tag<Geometry1>::type,
126 typename tag<Geometry2>::type,
127 Geometry1, Geometry2,
133 typename tag<Geometry1>::type,
134 typename tag<Geometry2>::type,
135 Geometry1, Geometry2,
144 turns, interrupt_policy);
150 }} // namespace boost::geometry
152 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP