]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/geometry/algorithms/detail/closest_points/utilities.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / geometry / algorithms / detail / closest_points / utilities.hpp
CommitLineData
1e59de90
TL
1// Boost.Geometry
2
3// Copyright (c) 2021, Oracle and/or its affiliates.
4
5// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6
7// Licensed under the Boost Software License version 1.0.
8// http://www.boost.org/users/license.html
9
10#ifndef BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP
11#define BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP
12
13#include <boost/geometry/strategies/distance.hpp>
14
15namespace boost { namespace geometry
16{
17
18namespace detail { namespace closest_points
19{
20
21struct set_segment_from_points
22{
23 template <typename Point1, typename Point2, typename Segment>
24 static inline void apply(Point1 const& p1, Point2 const& p2, Segment& segment)
25 {
26 assign_point_to_index<0>(p1, segment);
27 assign_point_to_index<1>(p2, segment);
28 }
29};
30
31
32struct swap_segment_points
33{
34 template <typename Segment>
35 static inline void apply(Segment& segment)
36 {
37 geometry::detail::for_each_dimension<Segment>([&](auto index)
38 {
39 auto temp = get<0,index>(segment);
40 set<0,index>(segment, get<1,index>(segment));
41 set<1,index>(segment, temp);
42 });
43 }
44};
45
46template <typename Geometry1, typename Geometry2, typename Strategies>
47using distance_strategy_t = decltype(
48 std::declval<Strategies>().distance(std::declval<Geometry1>(), std::declval<Geometry2>()));
49
50template <typename Geometry1, typename Geometry2, typename Strategies>
51using creturn_t = typename strategy::distance::services::return_type
52 <
53 typename strategy::distance::services::comparable_type
54 <
55 distance_strategy_t<Geometry1, Geometry2, Strategies>
56 >::type,
57 typename point_type<Geometry1>::type,
58 typename point_type<Geometry2>::type
59 >::type;
60
61
62}} // namespace detail::closest_points
63
64}} // namespace boost::geometry
65
66#endif //BOOST_GEOMETRY_ALGORITHMS_DETAIL_CLOSEST_POINTS_UTILITIES_HPP