File indexing completed on 2025-01-18 09:35:02
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP
0011 #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP
0012
0013 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
0014 #include <boost/geometry/util/algorithm.hpp>
0015
0016 #include <boost/geometry/strategies/distance.hpp>
0017
0018 namespace boost { namespace geometry
0019 {
0020
0021 namespace detail { namespace closest_points
0022 {
0023
0024 struct set_segment_from_points
0025 {
0026 template <typename Point1, typename Point2, typename Segment>
0027 static inline void apply(Point1 const& p1, Point2 const& p2, Segment& segment)
0028 {
0029 assign_point_to_index<0>(p1, segment);
0030 assign_point_to_index<1>(p2, segment);
0031 }
0032 };
0033
0034
0035 struct swap_segment_points
0036 {
0037 template <typename Segment>
0038 static inline void apply(Segment& segment)
0039 {
0040 geometry::detail::for_each_dimension<Segment>([&](auto index)
0041 {
0042 auto temp = get<0,index>(segment);
0043 set<0,index>(segment, get<1,index>(segment));
0044 set<1,index>(segment, temp);
0045 });
0046 }
0047 };
0048
0049 template <typename Geometry1, typename Geometry2, typename Strategies>
0050 using distance_strategy_t = decltype(
0051 std::declval<Strategies>().distance(std::declval<Geometry1>(), std::declval<Geometry2>()));
0052
0053 template <typename Geometry1, typename Geometry2, typename Strategies>
0054 using creturn_t = typename strategy::distance::services::return_type
0055 <
0056 typename strategy::distance::services::comparable_type
0057 <
0058 distance_strategy_t<Geometry1, Geometry2, Strategies>
0059 >::type,
0060 typename point_type<Geometry1>::type,
0061 typename point_type<Geometry2>::type
0062 >::type;
0063
0064
0065 }}
0066
0067 }}
0068
0069 #endif