]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/buffer/buffer_point_geo.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / buffer / buffer_point_geo.cpp
1 // Boost.Geometry
2 // Unit Test
3
4 // Copyright (c) 2018-2019 Barend Gehrels, Amsterdam, the Netherlands.
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 #include "test_buffer_geo.hpp"
11
12 static std::string const simplex = "POINT(4.9 52.0)";
13
14 template <bool Clockwise, typename PointType>
15 void test_point()
16 {
17 typedef bg::model::polygon<PointType, Clockwise> polygon;
18
19 bg::strategy::buffer::join_miter join_miter;
20 bg::strategy::buffer::end_flat end_flat;
21
22 // NOTE: for now do not test with a radius less than 2 meter, because is not precise yet (in double)
23 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 70.7107, 5.0, ut_settings(0.1, false, 8));
24 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 76.5437, 5.0, ut_settings(0.1, false, 16));
25 // * Result is different for clang/VCC. Specified expectation is in between, and tolerance higher
26 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 77.9640, 5.0, ut_settings(0.2, false, 32));
27
28 // The more points used for the buffer, the more the area approaches 10*PI square meters
29 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 282.8430, 10.0, ut_settings(0.1, false, 8));
30 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 306.1471, 10.0, ut_settings(0.1, false, 16));
31 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 312.1450, 10.0, ut_settings(0.1, false, 32));
32 // * Same here
33 test_one_geo<PointType, polygon>("simplex1", simplex, join_miter, end_flat, 313.9051, 10.0, ut_settings(0.2, false, 180));
34 }
35
36 int test_main(int, char* [])
37 {
38 BoostGeometryWriteTestConfiguration();
39
40 test_point<true, bg::model::point<default_test_type, 2, bg::cs::geographic<bg::degree> > >();
41
42 #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
43 test_point<true, bg::model::point<long double, 2, bg::cs::geographic<bg::degree> > >();
44 #endif
45
46 return 0;
47 }