Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:35:09

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-2020.
0006 // Modifications copyright (c) 2017-2020 Oracle and/or its affiliates.
0007 
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 #include <boost/geometry/policies/robustness/rescale_policy_tags.hpp>
0026 
0027 #include <boost/geometry/geometries/segment.hpp>
0028 
0029 namespace boost { namespace geometry
0030 {
0031 
0032 
0033 #ifndef DOXYGEN_NO_DETAIL
0034 namespace detail { namespace get_intersection_points
0035 {
0036 
0037 
0038 template
0039 <
0040     typename Point1,
0041     typename Point2,
0042     typename TurnInfo
0043 >
0044 struct get_turn_without_info
0045 {
0046     template
0047     <
0048         typename UniqueSubRange1,
0049         typename UniqueSubRange2,
0050         typename Strategy,
0051         typename RobustPolicy,
0052         typename OutputIterator
0053     >
0054     static inline OutputIterator apply(UniqueSubRange1 const& range_p,
0055                 UniqueSubRange2 const& range_q,
0056                 TurnInfo const& ,
0057                 Strategy const& strategy,
0058                 RobustPolicy const& ,
0059                 OutputIterator out)
0060     {
0061         // Make sure this is only called with no rescaling
0062         BOOST_STATIC_ASSERT((std::is_same
0063            <
0064                no_rescale_policy_tag,
0065                typename rescale_policy_type<RobustPolicy>::type
0066            >::value));
0067 
0068         typedef typename TurnInfo::point_type turn_point_type;
0069 
0070         typedef policies::relate::segments_intersection_points
0071             <
0072                 segment_intersection_points<turn_point_type>
0073             > policy_type;
0074 
0075         typename policy_type::return_type const result
0076             = strategy.relate().apply(range_p, range_q, policy_type());
0077 
0078         for (std::size_t i = 0; i < result.count; i++)
0079         {
0080             TurnInfo tp;
0081             geometry::convert(result.intersections[i], tp.point);
0082             *out++ = tp;
0083         }
0084 
0085         return out;
0086     }
0087 };
0088 
0089 }} // namespace detail::get_intersection_points
0090 #endif // DOXYGEN_NO_DETAIL
0091 
0092 
0093 
0094 
0095 template
0096 <
0097     typename Geometry1,
0098     typename Geometry2,
0099     typename RobustPolicy,
0100     typename Turns,
0101     typename Strategy
0102 >
0103 inline void get_intersection_points(Geometry1 const& geometry1,
0104             Geometry2 const& geometry2,
0105             RobustPolicy const& robust_policy,
0106             Turns& turns,
0107             Strategy const& strategy)
0108 {
0109     concepts::check_concepts_and_equal_dimensions<Geometry1 const, Geometry2 const>();
0110 
0111     typedef detail::get_intersection_points::get_turn_without_info
0112                         <
0113                             typename point_type<Geometry1>::type,
0114                             typename point_type<Geometry2>::type,
0115                             typename boost::range_value<Turns>::type
0116                         > TurnPolicy;
0117 
0118     detail::get_turns::no_interrupt_policy interrupt_policy;
0119 
0120     std::conditional_t
0121         <
0122             reverse_dispatch<Geometry1, Geometry2>::type::value,
0123             dispatch::get_turns_reversed
0124             <
0125                 typename tag<Geometry1>::type,
0126                 typename tag<Geometry2>::type,
0127                 Geometry1, Geometry2,
0128                 false, false,
0129                 TurnPolicy
0130             >,
0131             dispatch::get_turns
0132             <
0133                 typename tag<Geometry1>::type,
0134                 typename tag<Geometry2>::type,
0135                 Geometry1, Geometry2,
0136                 false, false,
0137                 TurnPolicy
0138             >
0139         >::apply(0, geometry1,
0140                  1, geometry2,
0141                  strategy,
0142                  robust_policy,
0143                  turns, interrupt_policy);
0144 }
0145 
0146 
0147 
0148 
0149 }} // namespace boost::geometry
0150 
0151 #endif // BOOST_GEOMETRY_ALGORITHMS_DETAIL_OVERLAY_GET_INTERSECTION_POINTS_HPP