3 // Copyright (c) 2019, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
7 // Licensed under the Boost Software License version 1.0.
8 // http://www.boost.org/users/license.html
10 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
11 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP
14 #include <boost/type_traits/is_same.hpp>
17 #include <boost/geometry/core/tags.hpp>
19 #include <boost/geometry/formulas/spherical.hpp>
21 #include <boost/geometry/strategies/spherical/area.hpp>
22 #include <boost/geometry/strategies/spherical/point_in_point.hpp>
23 #include <boost/geometry/strategies/point_order.hpp>
25 #include <boost/geometry/util/math.hpp>
26 #include <boost/geometry/util/select_calculation_type.hpp>
29 namespace boost { namespace geometry
32 namespace strategy { namespace point_order
35 //template <typename CalculationType = void>
38 // typedef azimuth_tag version_tag;
40 // template <typename Geometry>
43 // typedef typename geometry::select_calculation_type_alt
45 // CalculationType, Geometry
49 // template <typename Point>
50 // inline bool apply(Point const& p1, Point const& p2,
51 // typename result_type<Point>::type & azi,
52 // typename result_type<Point>::type & razi) const
54 // typedef typename result_type<Point>::type calc_t;
56 // if (equals_point_point(p1, p2))
61 // calc_t lon1 = geometry::get_as_radian<0>(p1);
62 // calc_t lat1 = geometry::get_as_radian<1>(p1);
63 // calc_t lon2 = geometry::get_as_radian<0>(p2);
64 // calc_t lat2 = geometry::get_as_radian<1>(p2);
66 // convert_latitudes<Point>(lat1, lat2);
68 // formula::result_spherical<calc_t>
69 // res = formula::spherical_azimuth<calc_t, true>(lon1, lat1, lon2, lat2);
72 // razi = res.reverse_azimuth;
77 // template <typename Point>
78 // inline typename result_type<Point>::type
79 // apply(Point const& /*p0*/, Point const& /*p1*/, Point const& /*p2*/,
80 // typename result_type<Point>::type const& azi1,
81 // typename result_type<Point>::type const& azi2) const
83 // // TODO: support poles
84 // return math::longitude_distance_signed<radian>(azi1, azi2);
88 // template <typename Point>
89 // static bool equals_point_point(Point const& p0, Point const& p1)
91 // return strategy::within::spherical_point_point::apply(p0, p1);
94 // template <typename Point, typename CalcT>
95 // static void convert_latitudes(CalcT & lat1, CalcT & lat2)
97 // static const bool is_polar = boost::is_same
99 // typename geometry::cs_tag<Point>::type,
100 // spherical_polar_tag
103 // if (BOOST_GEOMETRY_CONDITION(is_polar))
105 // CalcT pi_half = math::half_pi<CalcT>();
106 // lat1 = pi_half - lat1;
107 // lat2 = pi_half - lat2;
112 template <typename CalculationType = void>
114 : strategy::area::spherical<double, CalculationType>
116 typedef area_tag version_tag;
123 struct default_strategy<spherical_equatorial_tag>
125 typedef spherical<> type;
129 struct default_strategy<spherical_polar_tag>
131 typedef spherical<> type;
134 } // namespace services
136 }} // namespace strategy::point_order
138 }} // namespace boost::geometry
140 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_POINT_ORDER_HPP