File indexing completed on 2025-01-18 09:36:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_SIDE_HPP
0015 #define BOOST_GEOMETRY_STRATEGIES_GEOGRAPHIC_SIDE_HPP
0016
0017 #include <boost/geometry/core/cs.hpp>
0018 #include <boost/geometry/core/access.hpp>
0019 #include <boost/geometry/core/coordinate_promotion.hpp>
0020 #include <boost/geometry/core/radian_access.hpp>
0021 #include <boost/geometry/core/radius.hpp>
0022
0023 #include <boost/geometry/formulas/spherical.hpp>
0024
0025 #include <boost/geometry/srs/spheroid.hpp>
0026
0027
0028 #include <boost/geometry/strategies/geographic/disjoint_segment_box.hpp>
0029 #include <boost/geometry/strategies/geographic/parameters.hpp>
0030 #include <boost/geometry/strategies/side.hpp>
0031 #include <boost/geometry/strategies/spherical/point_in_point.hpp>
0032
0033 #include <boost/geometry/strategy/geographic/envelope.hpp>
0034
0035 #include <boost/geometry/util/math.hpp>
0036 #include <boost/geometry/util/select_calculation_type.hpp>
0037
0038 namespace boost { namespace geometry
0039 {
0040
0041
0042 namespace strategy { namespace side
0043 {
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 template
0060 <
0061 typename FormulaPolicy = strategy::andoyer,
0062 typename Spheroid = srs::spheroid<double>,
0063 typename CalculationType = void
0064 >
0065 class geographic
0066 {
0067 public:
0068 typedef geographic_tag cs_tag;
0069
0070 geographic() = default;
0071
0072 explicit geographic(Spheroid const& model)
0073 : m_model(model)
0074 {}
0075
0076 template <typename P1, typename P2, typename P>
0077 inline int apply(P1 const& p1, P2 const& p2, P const& p) const
0078 {
0079 typedef strategy::within::spherical_point_point equals_point_point_strategy_type;
0080 if (equals_point_point_strategy_type::apply(p, p1)
0081 || equals_point_point_strategy_type::apply(p, p2)
0082 || equals_point_point_strategy_type::apply(p1, p2))
0083 {
0084 return 0;
0085 }
0086
0087 typedef typename promote_floating_point
0088 <
0089 typename select_calculation_type_alt
0090 <
0091 CalculationType,
0092 P1, P2, P
0093 >::type
0094 >::type calc_t;
0095
0096 typedef typename FormulaPolicy::template inverse
0097 <calc_t, false, true, false, false, false> inverse_formula;
0098
0099 calc_t a1p = azimuth<calc_t, inverse_formula>(p1, p, m_model);
0100 calc_t a12 = azimuth<calc_t, inverse_formula>(p1, p2, m_model);
0101
0102 return formula::azimuth_side_value(a1p, a12);
0103 }
0104
0105 Spheroid const& model() const
0106 {
0107 return m_model;
0108 }
0109
0110 private:
0111 template <typename ResultType,
0112 typename InverseFormulaType,
0113 typename Point1,
0114 typename Point2,
0115 typename ModelT>
0116 static inline ResultType azimuth(Point1 const& point1, Point2 const& point2,
0117 ModelT const& model)
0118 {
0119 return InverseFormulaType::apply(get_as_radian<0>(point1),
0120 get_as_radian<1>(point1),
0121 get_as_radian<0>(point2),
0122 get_as_radian<1>(point2),
0123 model).azimuth;
0124 }
0125
0126 Spheroid m_model;
0127 };
0128
0129
0130 }}
0131
0132
0133 }}
0134
0135
0136 #endif