]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/geometry/strategies/spherical/disjoint_segment_box.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / geometry / strategies / spherical / disjoint_segment_box.hpp
1 // Boost.Geometry
2
3 // Copyright (c) 2017 Oracle and/or its affiliates.
4
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11
12 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
13 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
14
15
16 #include <cstddef>
17 #include <utility>
18
19 #include <boost/numeric/conversion/cast.hpp>
20
21 #include <boost/geometry/util/math.hpp>
22 #include <boost/geometry/util/calculation_type.hpp>
23
24 #include <boost/geometry/core/access.hpp>
25 #include <boost/geometry/core/tags.hpp>
26 #include <boost/geometry/core/coordinate_dimension.hpp>
27 #include <boost/geometry/core/point_type.hpp>
28
29 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
30 #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
31
32 #include <boost/geometry/strategies/spherical/azimuth.hpp>
33 #include <boost/geometry/strategies/disjoint.hpp>
34
35 namespace boost { namespace geometry { namespace strategy { namespace disjoint
36 {
37
38 // NOTE: This may be temporary place for this or corresponding strategy
39 // It seems to be more appropriate to implement the opposite of it
40 // e.g. intersection::segment_box because in disjoint() algorithm
41 // other strategies that are used are intersection and covered_by strategies.
42 struct segment_box_spherical
43 {
44 template <typename Segment, typename Box>
45 struct point_in_geometry_strategy
46 : services::default_strategy
47 <
48 typename point_type<Segment>::type,
49 Box
50 >
51 {};
52
53 template <typename Segment, typename Box>
54 static inline typename point_in_geometry_strategy<Segment, Box>::type
55 get_point_in_geometry_strategy()
56 {
57 typedef typename point_in_geometry_strategy<Segment, Box>::type strategy_type;
58
59 return strategy_type();
60 }
61
62 template <typename Segment, typename Box>
63 static inline bool apply(Segment const& segment, Box const& box)
64 {
65 typedef typename point_type<Segment>::type segment_point_type;
66 typedef typename coordinate_type<segment_point_type>::type CT;
67 geometry::strategy::azimuth::spherical<CT> azimuth_strategy;
68
69 return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
70 <spherical_equatorial_tag>::apply(segment, box, azimuth_strategy);
71 }
72 };
73
74
75 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
76
77
78 namespace services
79 {
80
81 template <typename Linear, typename Box, typename LinearTag>
82 struct default_strategy<Linear, Box, LinearTag, box_tag, 1, 2,
83 spherical_equatorial_tag, spherical_equatorial_tag>
84 {
85 typedef segment_box_spherical type;
86 };
87
88 template <typename Box, typename Linear, typename LinearTag>
89 struct default_strategy<Box, Linear, box_tag, LinearTag, 2, 1,
90 spherical_equatorial_tag, spherical_equatorial_tag>
91 {
92 typedef segment_box_spherical type;
93 };
94
95 } // namespace services
96
97
98 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
99
100
101 }}}} // namespace boost::geometry::strategy::disjoint
102
103
104 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
105