]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | // Boost.Geometry |
2 | ||
92f5a8d4 | 3 | // Copyright (c) 2017-2019 Oracle and/or its affiliates. |
b32b8144 FG |
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 | ||
92f5a8d4 TL |
32 | // TODO: spherical_point_box currently defined in the same file as cartesian |
33 | #include <boost/geometry/strategies/cartesian/point_in_box.hpp> | |
b32b8144 | 34 | #include <boost/geometry/strategies/disjoint.hpp> |
92f5a8d4 TL |
35 | #include <boost/geometry/strategies/normalize.hpp> |
36 | #include <boost/geometry/strategies/spherical/azimuth.hpp> | |
37 | #include <boost/geometry/strategies/spherical/disjoint_box_box.hpp> | |
38 | ||
b32b8144 FG |
39 | |
40 | namespace boost { namespace geometry { namespace strategy { namespace disjoint | |
41 | { | |
42 | ||
43 | // NOTE: This may be temporary place for this or corresponding strategy | |
44 | // It seems to be more appropriate to implement the opposite of it | |
45 | // e.g. intersection::segment_box because in disjoint() algorithm | |
46 | // other strategies that are used are intersection and covered_by strategies. | |
47 | struct segment_box_spherical | |
48 | { | |
92f5a8d4 | 49 | typedef covered_by::spherical_point_box disjoint_point_box_strategy_type; |
b32b8144 | 50 | |
92f5a8d4 | 51 | static inline disjoint_point_box_strategy_type get_disjoint_point_box_strategy() |
b32b8144 | 52 | { |
92f5a8d4 | 53 | return disjoint_point_box_strategy_type(); |
b32b8144 FG |
54 | } |
55 | ||
56 | template <typename Segment, typename Box> | |
57 | static inline bool apply(Segment const& segment, Box const& box) | |
58 | { | |
59 | typedef typename point_type<Segment>::type segment_point_type; | |
60 | typedef typename coordinate_type<segment_point_type>::type CT; | |
61 | geometry::strategy::azimuth::spherical<CT> azimuth_strategy; | |
62 | ||
63 | return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid | |
92f5a8d4 TL |
64 | < |
65 | spherical_equatorial_tag | |
66 | >::apply(segment, box, | |
67 | azimuth_strategy, | |
68 | strategy::normalize::spherical_point(), | |
69 | strategy::covered_by::spherical_point_box(), | |
70 | strategy::disjoint::spherical_box_box()); | |
b32b8144 FG |
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 |