]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/perimeter/perimeter_sph.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2016 Oracle and/or its affiliates.
5 // Contributed and/or modified by Vissarion Fisikopoulos, on behalf of Oracle
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #include <algorithms/test_perimeter.hpp>
12 #include <algorithms/perimeter/perimeter_polygon_cases.hpp>
14 #include <boost/geometry/geometries/geometries.hpp>
15 #include <boost/geometry/geometries/point_xy.hpp>
18 void test_all_default() //test the default strategy
20 double const pi
= boost::math::constants::pi
<double>();
22 for (std::size_t i
= 0; i
<= 2; ++i
)
24 test_geometry
<bg::model::polygon
<P
> >(poly_data_sph
[i
], 2 * pi
);
28 test_geometry
<bg::model::multi_polygon
<bg::model::polygon
<P
> > >
29 (multipoly_data
[0], 3 * pi
);
31 // Geometries with length zero
32 test_geometry
<P
>("POINT(0 0)", 0);
33 test_geometry
<bg::model::linestring
<P
> >("LINESTRING(0 0,3 4,4 3)", 0);
38 void test_all_haversine(double const mean_radius
)
40 double const pi
= boost::math::constants::pi
<double>();
41 bg::strategy::distance::haversine
<double> haversine_strategy(mean_radius
);
43 for (std::size_t i
= 0; i
<= 2; ++i
)
45 test_geometry
<bg::model::polygon
<P
> >(poly_data_sph
[i
],
51 test_geometry
<bg::model::multi_polygon
<bg::model::polygon
<P
> > >
56 // Geometries with length zero
57 test_geometry
<P
>("POINT(0 0)", 0, haversine_strategy
);
58 test_geometry
<bg::model::linestring
<P
> >("LINESTRING(0 0,3 4,4 3)",
63 int test_main(int, char* [])
65 //Earth radius estimation in Km
66 //(see https://en.wikipedia.org/wiki/Earth_radius)
67 double const mean_radius
= 6371.0;
69 test_all_default
<bg::model::d2::point_xy
<int,
70 bg::cs::spherical_equatorial
<bg::degree
> > >();
71 test_all_default
<bg::model::d2::point_xy
<float,
72 bg::cs::spherical_equatorial
<bg::degree
> > >();
73 test_all_default
<bg::model::d2::point_xy
<double,
74 bg::cs::spherical_equatorial
<bg::degree
> > >();
76 test_all_haversine
<bg::model::d2::point_xy
<int,
77 bg::cs::spherical_equatorial
<bg::degree
> > >(mean_radius
);
78 test_all_haversine
<bg::model::d2::point_xy
<float,
79 bg::cs::spherical_equatorial
<bg::degree
> > >(mean_radius
);
80 test_all_haversine
<bg::model::d2::point_xy
<double,
81 bg::cs::spherical_equatorial
<bg::degree
> > >(mean_radius
);
83 #if defined(HAVE_TTMATH)
84 test_all
<bg::model::d2::point_xy
<ttmath_big
> >();