3 // Copyright (c) 2017 Oracle and/or its affiliates.
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
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)
12 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
13 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
19 #include <boost/numeric/conversion/cast.hpp>
21 #include <boost/geometry/util/math.hpp>
22 #include <boost/geometry/util/calculation_type.hpp>
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>
29 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
30 #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
32 #include <boost/geometry/strategies/spherical/azimuth.hpp>
33 #include <boost/geometry/strategies/disjoint.hpp>
35 namespace boost { namespace geometry { namespace strategy { namespace disjoint
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
44 template <typename Segment, typename Box>
45 struct point_in_geometry_strategy
46 : services::default_strategy
48 typename point_type<Segment>::type,
53 template <typename Segment, typename Box>
54 static inline typename point_in_geometry_strategy<Segment, Box>::type
55 get_point_in_geometry_strategy()
57 typedef typename point_in_geometry_strategy<Segment, Box>::type strategy_type;
59 return strategy_type();
62 template <typename Segment, typename Box>
63 static inline bool apply(Segment const& segment, Box const& box)
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;
69 return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
70 <spherical_equatorial_tag>::apply(segment, box, azimuth_strategy);
75 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
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>
85 typedef segment_box_spherical type;
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>
92 typedef segment_box_spherical type;
95 } // namespace services
98 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
101 }}}} // namespace boost::geometry::strategy::disjoint
104 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP