Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-06-30 08:15:38

0001 // Boost.Geometry
0002 
0003 // Copyright (c) 2017-2019 Oracle and/or its affiliates.
0004 
0005 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
0006 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
0007 
0008 // Use, modification and distribution is subject to the Boost Software License,
0009 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
0010 // http://www.boost.org/LICENSE_1_0.txt)
0011 
0012 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
0013 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
0014 
0015 
0016 #include <cstddef>
0017 #include <utility>
0018 
0019 #include <boost/geometry/core/access.hpp>
0020 #include <boost/geometry/core/tags.hpp>
0021 #include <boost/geometry/core/coordinate_dimension.hpp>
0022 #include <boost/geometry/core/point_type.hpp>
0023 
0024 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
0025 #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
0026 
0027 // TODO: spherical_point_box currently defined in the same file as cartesian
0028 #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
0029 #include <boost/geometry/strategies/disjoint.hpp>
0030 #include <boost/geometry/strategies/normalize.hpp>
0031 #include <boost/geometry/strategies/spherical/azimuth.hpp>
0032 #include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
0033 
0034 #include <boost/geometry/util/math.hpp>
0035 #include <boost/geometry/util/calculation_type.hpp>
0036 
0037 
0038 namespace boost { namespace geometry { namespace strategy { namespace disjoint
0039 {
0040 
0041 // NOTE: This may be temporary place for this or corresponding strategy
0042 // It seems to be more appropriate to implement the opposite of it
0043 // e.g. intersection::segment_box because in disjoint() algorithm
0044 // other strategies that are used are intersection and covered_by strategies.
0045 struct segment_box_spherical
0046 {
0047     typedef covered_by::spherical_point_box disjoint_point_box_strategy_type;
0048 
0049     static inline disjoint_point_box_strategy_type get_disjoint_point_box_strategy()
0050     {
0051         return disjoint_point_box_strategy_type();
0052     }
0053 
0054     template <typename Segment, typename Box>
0055     static inline bool apply(Segment const& segment, Box const& box)
0056     {
0057         typedef typename point_type<Segment>::type segment_point_type;
0058         typedef typename coordinate_type<segment_point_type>::type CT;
0059         geometry::strategy::azimuth::spherical<CT> azimuth_strategy;
0060 
0061         return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
0062                 <
0063                     spherical_equatorial_tag
0064                 >::apply(segment, box,
0065                          azimuth_strategy,
0066                          strategy::normalize::spherical_point(),
0067                          strategy::covered_by::spherical_point_box(),
0068                          strategy::disjoint::spherical_box_box());
0069     }
0070 };
0071 
0072 
0073 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0074 
0075 
0076 namespace services
0077 {
0078 
0079 template <typename Linear, typename Box, typename LinearTag>
0080 struct default_strategy<Linear, Box, LinearTag, box_tag, 1, 2,
0081                         spherical_equatorial_tag, spherical_equatorial_tag>
0082 {
0083     typedef segment_box_spherical type;
0084 };
0085 
0086 template <typename Box, typename Linear, typename LinearTag>
0087 struct default_strategy<Box, Linear, box_tag, LinearTag, 2, 1,
0088                         spherical_equatorial_tag, spherical_equatorial_tag>
0089 {
0090     typedef segment_box_spherical type;
0091 };
0092 
0093 } // namespace services
0094 
0095 
0096 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0097 
0098 
0099 }}}} // namespace boost::geometry::strategy::disjoint
0100 
0101 
0102 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_DISJOINT_SEGMENT_BOX_HPP
0103