]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/include/boost/geometry/strategies/spherical/side_by_cross_track.hpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / include / boost / geometry / strategies / spherical / side_by_cross_track.hpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2014.
6 // Modifications copyright (c) 2014, Oracle and/or its affiliates.
7
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #ifndef BOOST_GEOMETRY_STRATEGIES_SPHERICAL_SIDE_BY_CROSS_TRACK_HPP
15 #define BOOST_GEOMETRY_STRATEGIES_SPHERICAL_SIDE_BY_CROSS_TRACK_HPP
16
17 #include <boost/geometry/core/cs.hpp>
18 #include <boost/geometry/core/access.hpp>
19 #include <boost/geometry/core/radian_access.hpp>
20
21 #include <boost/geometry/algorithms/detail/course.hpp>
22
23 #include <boost/geometry/util/math.hpp>
24 #include <boost/geometry/util/promote_floating_point.hpp>
25 #include <boost/geometry/util/select_calculation_type.hpp>
26
27 #include <boost/geometry/strategies/side.hpp>
28 //#include <boost/geometry/strategies/concepts/side_concept.hpp>
29
30
31 namespace boost { namespace geometry
32 {
33
34
35 namespace strategy { namespace side
36 {
37
38 /*!
39 \brief Check at which side of a Great Circle segment a point lies
40 left of segment (> 0), right of segment (< 0), on segment (0)
41 \ingroup strategies
42 \tparam CalculationType \tparam_calculation
43 */
44 template <typename CalculationType = void>
45 class side_by_cross_track
46 {
47
48 public :
49 template <typename P1, typename P2, typename P>
50 static inline int apply(P1 const& p1, P2 const& p2, P const& p)
51 {
52 typedef typename promote_floating_point
53 <
54 typename select_calculation_type_alt
55 <
56 CalculationType,
57 P1, P2, P
58 >::type
59 >::type calc_t;
60
61 calc_t d1 = 0.001; // m_strategy.apply(sp1, p);
62 calc_t crs_AD = geometry::detail::course<calc_t>(p1, p);
63 calc_t crs_AB = geometry::detail::course<calc_t>(p1, p2);
64 calc_t XTD = asin(sin(d1) * sin(crs_AD - crs_AB));
65
66 return math::equals(XTD, 0) ? 0 : XTD < 0 ? 1 : -1;
67 }
68 };
69
70 }} // namespace strategy::side
71
72
73 }} // namespace boost::geometry
74
75
76 #endif // BOOST_GEOMETRY_STRATEGIES_SPHERICAL_SIDE_BY_CROSS_TRACK_HPP