Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:36:45

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_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP
0013 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP
0014 
0015 
0016 #include <cstddef>
0017 #include <utility>
0018 
0019 #include <boost/numeric/conversion/cast.hpp>
0020 
0021 #include <boost/geometry/util/math.hpp>
0022 #include <boost/geometry/util/calculation_type.hpp>
0023 
0024 #include <boost/geometry/core/access.hpp>
0025 #include <boost/geometry/core/tags.hpp>
0026 #include <boost/geometry/core/coordinate_dimension.hpp>
0027 #include <boost/geometry/core/point_type.hpp>
0028 
0029 #include <boost/geometry/algorithms/detail/assign_indexed_point.hpp>
0030 #include <boost/geometry/algorithms/detail/disjoint/segment_box.hpp>
0031 
0032 #include <boost/geometry/srs/spheroid.hpp>
0033 
0034 // TODO: spherical_point_box currently defined in the same file as cartesian
0035 #include <boost/geometry/strategies/cartesian/point_in_box.hpp>
0036 #include <boost/geometry/strategies/disjoint.hpp>
0037 #include <boost/geometry/strategies/geographic/azimuth.hpp>
0038 #include <boost/geometry/strategies/geographic/parameters.hpp>
0039 #include <boost/geometry/strategies/normalize.hpp>
0040 #include <boost/geometry/strategies/spherical/disjoint_box_box.hpp>
0041 
0042 
0043 namespace boost { namespace geometry { namespace strategy { namespace disjoint
0044 {
0045 
0046 // NOTE: This may be temporary place for this or corresponding strategy
0047 // It seems to be more appropriate to implement the opposite of it
0048 // e.g. intersection::segment_box because in disjoint() algorithm
0049 // other strategies that are used are intersection and covered_by strategies.
0050 template
0051 <
0052     typename FormulaPolicy = strategy::andoyer,
0053     typename Spheroid = srs::spheroid<double>,
0054     typename CalculationType = void
0055 >
0056 struct segment_box_geographic
0057 {
0058 public:
0059     typedef Spheroid model_type;
0060 
0061     inline segment_box_geographic()
0062         : m_spheroid()
0063     {}
0064 
0065     explicit inline segment_box_geographic(Spheroid const& spheroid)
0066         : m_spheroid(spheroid)
0067     {}
0068 
0069     typedef covered_by::spherical_point_box disjoint_point_box_strategy_type;
0070 
0071     static inline disjoint_point_box_strategy_type get_disjoint_point_box_strategy()
0072     {
0073         return disjoint_point_box_strategy_type();
0074     }
0075 
0076     template <typename Segment, typename Box>
0077     inline bool apply(Segment const& segment, Box const& box) const
0078     {
0079         geometry::strategy::azimuth::geographic
0080             <
0081                 FormulaPolicy,
0082                 Spheroid,
0083                 CalculationType
0084             > azimuth_geographic(m_spheroid);
0085 
0086         return geometry::detail::disjoint::disjoint_segment_box_sphere_or_spheroid
0087                 <
0088                     geographic_tag
0089                 >::apply(segment, box,
0090                          azimuth_geographic,
0091                          strategy::normalize::spherical_point(),
0092                          strategy::covered_by::spherical_point_box(),
0093                          strategy::disjoint::spherical_box_box());
0094     }
0095 
0096     Spheroid const& model() const
0097     {
0098         return m_spheroid;
0099     }
0100 
0101 private:
0102     Spheroid m_spheroid;
0103 };
0104 
0105 
0106 #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0107 
0108 
0109 namespace services
0110 {
0111 
0112 template <typename Linear, typename Box, typename LinearTag>
0113 struct default_strategy<Linear, Box, LinearTag, box_tag, 1, 2,
0114                         geographic_tag, geographic_tag>
0115 {
0116     typedef segment_box_geographic<> type;
0117 };
0118 
0119 template <typename Box, typename Linear, typename LinearTag>
0120 struct default_strategy<Box, Linear, box_tag, LinearTag, 2, 1,
0121                         geographic_tag, geographic_tag>
0122 {
0123     typedef segment_box_geographic<> type;
0124 };
0125 
0126 
0127 } // namespace services
0128 
0129 
0130 #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
0131 
0132 
0133 }}}} // namespace boost::geometry::strategy::disjoint
0134 
0135 
0136 #endif // BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_DISJOINT_SEGMENT_BOX_HPP