// Boost.Geometry // Copyright (c) 2021-2023, Oracle and/or its affiliates. // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP #define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP #include #include #include namespace boost { namespace geometry { namespace detail { namespace closest_points { struct set_segment_from_points { template static inline void apply(Point1 const& p1, Point2 const& p2, Segment& segment) { assign_point_to_index<0>(p1, segment); assign_point_to_index<1>(p2, segment); } }; struct swap_segment_points { template static inline void apply(Segment& segment) { geometry::detail::for_each_dimension([&](auto index) { auto temp = get<0,index>(segment); set<0,index>(segment, get<1,index>(segment)); set<1,index>(segment, temp); }); } }; template using distance_strategy_t = decltype( std::declval().distance(std::declval(), std::declval())); template using creturn_t = typename strategy::distance::services::return_type < typename strategy::distance::services::comparable_type < distance_strategy_t >::type, typename point_type::type, typename point_type::type >::type; }} // namespace detail::closest_points }} // namespace boost::geometry #endif //BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP