Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:30:35

0001 // Boost.Geometry (aka GGL, Generic Geometry Library)
0002 
0003 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
0004 
0005 // This file was modified by Oracle on 2017-2024.
0006 // Modifications copyright (c) 2017-2024 Oracle and/or its affiliates.
0007 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0008 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0009 
0010 // Use, modification and distribution is subject to the Boost Software License,
0011 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0012 // http://www.boost.org/LICENSE_1_0.txt)
0013 
0014 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
0015 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP
0016 
0017 
0018 #include <cstddef>
0019 #include <type_traits>
0020 
0021 #include <boost/range/value_type.hpp>
0022 
0023 #include <boost/geometry/algorithms/convert.hpp>
0024 #include <boost/geometry/algorithms/detail/overlay/get_turns.hpp>
0025 
0026 #include <boost/geometry/geometries/segment.hpp>
0027 
0028 namespace boost { namespace geometry
0029 {
0030 
0031 
0032 #ifndef DOXYGEN_NO_DETAIL
0033 namespace detail { namespace get_intersection_points
0034 {
0035 
0036 
0037 template
0038 <
0039     typename Point1,
0040     typename Point2,
0041     typename TurnInfo
0042 >
0043 struct get_turn_without_info
0044 {
0045     template
0046     <
0047         typename UniqueSubRange1,
0048         typename UniqueSubRange2,
0049         typename Strategy,
0050         typename OutputIterator
0051     >
0052     static inline OutputIterator apply(UniqueSubRange1 const& range_p,
0053                 UniqueSubRange2 const& range_q,
0054                 TurnInfo const& ,
0055                 Strategy const& strategy,
0056                 OutputIterator out)
0057     {
0058         using turn_point_type = typename TurnInfo::point_type;
0059 
0060         using policy_type = policies::relate::segments_intersection_points
0061             <
0062                 segment_intersection_points<turn_point_type>
0063             >;
0064 
0065         typename policy_type::return_type const result
0066             = strategy.relate().apply(range_p, range_q, policy_type());
0067 
0068         for (std::size_t i = 0; i < result.count; i++)
0069         {
0070             TurnInfo tp;
0071             geometry::convert(result.intersections[i], tp.point);
0072             *out++ = tp;
0073         }
0074 
0075         return out;
0076     }
0077 };
0078 
0079 }} // namespace detail::get_intersection_points
0080 #endif // DOXYGEN_NO_DETAIL
0081 
0082 
0083 
0084 
0085 template
0086 <
0087     typename Geometry1,
0088     typename Geometry2,
0089     typename Turns,
0090     typename Strategy
0091 >
0092 inline void get_intersection_points(Geometry1 const& geometry1,
0093             Geometry2 const& geometry2,
0094             Turns& turns,
0095             Strategy const& strategy)
0096 {
0097     concepts::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2 const>();
0098 
0099     using turn_policy_t = detail::get_intersection_points::get_turn_without_info
0100         <
0101             point_type_t<Geometry1>,
0102             point_type_t<Geometry2>,
0103             typename boost::range_value<Turns>::type
0104         >;
0105 
0106     detail::get_turns::no_interrupt_policy interrupt_policy;
0107 
0108     std::conditional_t
0109         <
0110             reverse_dispatch<Geometry1, Geometry2>::type::value,
0111             dispatch::get_turns_reversed
0112             <
0113                 tag_t<Geometry1>,
0114                 tag_t<Geometry2>,
0115                 Geometry1, Geometry2,
0116                 false, false,
0117                 turn_policy_t
0118             >,
0119             dispatch::get_turns
0120             <
0121                 tag_t<Geometry1>,
0122                 tag_t<Geometry2>,
0123                 Geometry1, Geometry2,
0124                 false, false,
0125                 turn_policy_t
0126             >
0127         >::apply(0, geometry1,
0128                  1, geometry2,
0129                  strategy,
0130                  turns, interrupt_policy);
0131 }
0132 
0133 
0134 
0135 
0136 }} // namespace boost::geometry
0137 
0138 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP