]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/strategies/envelope_segment.cpp
3 // Copyright (c) 2016-2018 Oracle and/or its affiliates.
5 // Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 #include <geometry_test_common.hpp>
13 #include <boost/geometry/io/wkt/wkt.hpp>
14 #include <boost/geometry/geometries/box.hpp>
15 #include <boost/geometry/strategies/geographic/envelope_segment.hpp>
16 #include <boost/geometry/strategies/spherical/envelope_segment.hpp>
20 typename FormulaPolicy
,
24 void test_strategies_lat(P p1
, P p2
, CT expected_max
, CT expected_min
,
25 CT expected_max_sph
, CT expected_min_sph
, CT error
= 0.0001)
27 bg::model::box
<P
> box
;
29 bg::strategy::envelope::geographic_segment
32 bg::srs::spheroid
<CT
>,
36 strategy_geo
.apply(p1
, p2
, box
);
38 CT p_min_degree_geo
= bg::get
<0, 1>(box
);
39 CT p_max_degree_geo
= bg::get
<1, 1>(box
);
41 BOOST_CHECK_CLOSE(p_max_degree_geo
, expected_max
, error
);
42 BOOST_CHECK_CLOSE(p_min_degree_geo
, expected_min
, error
);
44 typedef bg::strategy::envelope::spherical_segment
<CT
> strategy_sph_t
;
46 strategy_sph_t::apply(p1
, p2
, box
);
48 CT p_min_degree_sph
= bg::get
<0, 1>(box
);
49 CT p_max_degree_sph
= bg::get
<1, 1>(box
);
51 BOOST_CHECK_CLOSE(p_max_degree_sph
, expected_max_sph
, error
);
52 BOOST_CHECK_CLOSE(p_min_degree_sph
, expected_min_sph
, error
);
56 template <typename CT
>
59 typedef bg::model::point
<CT
, 2, bg::cs::geographic
<bg::degree
> > Pg
;
62 test_strategies_lat
<bg::strategy::thomas
>
63 (Pg(1, 1), Pg(10, 5), 5.0, 1.0, 5.0, 1.0);
65 test_strategies_lat
<bg::strategy::thomas
>
66 (Pg(1, 1), Pg(10, 1), 1.0031124506594733, 1.0, 1.0030915676477881, 1.0);
67 test_strategies_lat
<bg::strategy::thomas
>
68 (Pg(-5, 1), Pg(4, 1), 1.0031124506594733, 1.0, 1.0030915676477881, 1.0);
69 test_strategies_lat
<bg::strategy::thomas
>
70 (Pg(175, 1), Pg(184, 1), 1.0031124506594733, 1.0, 1.0030915676477881, 1.0);
71 test_strategies_lat
<bg::strategy::thomas
>
72 (Pg(355, 1), Pg(4, 1), 1.0031124506594733, 1.0, 1.0030915676477881, 1.0);
75 test_strategies_lat
<bg::strategy::thomas
>
76 (Pg(1, 2), Pg(70, 1), 2.0239716998355468, 1.0, 2.0228167431951536, 1.0);
77 test_strategies_lat
<bg::strategy::thomas
>
78 (Pg(70, 1), Pg(1, 2), 2.0239716998351849, 1.0, 2.022816743195063, 1.0);
81 test_strategies_lat
<bg::strategy::thomas
>
82 (Pg(0, 1), Pg(170, 1), 11.975026023950877, 1.0, 11.325049479775814, 1.0);
83 test_strategies_lat
<bg::strategy::thomas
>
84 (Pg(0, 1), Pg(179, 1), 68.452669316418039, 1.0, 63.437566893227093, 1.0);
85 test_strategies_lat
<bg::strategy::thomas
>
86 (Pg(0, 1), Pg(179.5, 1), 78.84050225214871, 1.0, 75.96516822754981, 1.0);
87 test_strategies_lat
<bg::strategy::thomas
>
88 (Pg(0, 1), Pg(180.5, 1), 78.84050225214871, 1.0, 75.965168227550194, 1.0);
89 test_strategies_lat
<bg::strategy::thomas
>
90 (Pg(0, 1), Pg(180, 1), 90.0, 1.0, 90.0, 1.0);
93 test_strategies_lat
<bg::strategy::thomas
>
94 (Pg(1, -1), Pg(10, -5), -1.0, -5.0, -1.0, -5.0);
95 test_strategies_lat
<bg::strategy::thomas
>
96 (Pg(1, -1), Pg(10, -1), -1.0, -1.0031124506594733, -1.0, -1.0030915676477881);
97 test_strategies_lat
<bg::strategy::thomas
>
98 (Pg(1, -1), Pg(170, -1), -1.0, -10.85834257048573, -1.0, -10.321374780571153);
100 // Different strategies for inverse
101 test_strategies_lat
<bg::strategy::thomas
>
102 (Pg(1, 1), Pg(10, 1), 1.0031124506594733, 1.0,
103 1.0030915676477881, 1.0, 0.00000001);
104 test_strategies_lat
<bg::strategy::andoyer
>
105 (Pg(1, 1), Pg(10, 1), 1.0031124504591062, 1.0,
106 1.0030915676477881, 1.0, 0.00000001);
107 test_strategies_lat
<bg::strategy::vincenty
>
108 (Pg(1, 1), Pg(10, 1), 1.0031124508942098, 1.0,
109 1.0030915676477881, 1.0, 0.00000001);
111 // Meridian and equator
112 test_strategies_lat
<bg::strategy::thomas
>
113 (Pg(1, 10), Pg(1, -10), 10.0, -10.0, 10.0, -10.0);
114 test_strategies_lat
<bg::strategy::thomas
>
115 (Pg(1, 0), Pg(10, 0), 0.0, 0.0, 0.0, 0.0);
117 // One endpoint in northern hemisphere and the other in southern hemisphere
118 test_strategies_lat
<bg::strategy::thomas
>
119 (Pg(1, 1), Pg(150, -5), 1.0, -8.1825389632359933, 1.0, -8.0761230625567588);
120 test_strategies_lat
<bg::strategy::thomas
>
121 (Pg(150, -5), Pg(1, 1), 1.0, -8.1825389632359933, 1.0, -8.0761230625568015);
122 test_strategies_lat
<bg::strategy::thomas
>
123 (Pg(150, 5), Pg(1, -1), 8.1825389632359933, -1.0, 8.0761230625568015, -1.0);
128 int test_main( int , char* [] )