]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/index/test/algorithms/union_content.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / index / test / algorithms / union_content.cpp
1 // Boost.Geometry Index
2 // Unit Test
3
4 // Copyright (c) 2011-2013 Adam Wulkiewicz, Lodz, Poland.
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 <algorithms/test_union_content.hpp>
11
12 #include <boost/geometry/geometries/point_xy.hpp>
13 #include <boost/geometry/geometries/point.hpp>
14 #include <boost/geometry/geometries/box.hpp>
15
16 //#define BOOST_GEOMETRY_TEST_DEBUG
17
18 void test_large_integers()
19 {
20 typedef bg::model::point<int, 2, bg::cs::cartesian> int_point_type;
21 typedef bg::model::point<double, 2, bg::cs::cartesian> double_point_type;
22
23 bg::model::box<int_point_type> int_box1, int_box2;
24 bg::model::box<double_point_type> double_box1, double_box2;
25
26 std::string const box_li1 = "POLYGON((1536119 192000, 1872000 528000))";
27 std::string const box_li2 = "POLYGON((1701234 368250, 2673400 777400))";
28 bg::read_wkt(box_li1, int_box1);
29 bg::read_wkt(box_li1, double_box1);
30 bg::read_wkt(box_li2, int_box2);
31 bg::read_wkt(box_li2, double_box2);
32
33 double int_value = bgi::detail::union_content(int_box1, int_box2);
34 double double_value = bgi::detail::union_content(double_box1, double_box2);
35
36 BOOST_CHECK_CLOSE(int_value, double_value, 0.0001);
37 }
38
39 int test_main(int, char* [])
40 {
41 typedef bg::model::point<int, 2, bg::cs::cartesian> P2ic;
42 typedef bg::model::point<float, 2, bg::cs::cartesian> P2fc;
43 typedef bg::model::point<double, 2, bg::cs::cartesian> P2dc;
44
45 typedef bg::model::point<int, 3, bg::cs::cartesian> P3ic;
46 typedef bg::model::point<float, 3, bg::cs::cartesian> P3fc;
47 typedef bg::model::point<double, 3, bg::cs::cartesian> P3dc;
48
49 test_geometry<bg::model::box<P2ic> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
50 test_geometry<bg::model::box<P2fc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
51 test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((1 2,3 5))", 12.0);
52 test_geometry<bg::model::box<P3ic> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
53 test_geometry<bg::model::box<P3fc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
54 test_geometry<bg::model::box<P3dc> >("POLYGON((0 1 2,2 4 6))", "POLYGON((1 2 3,3 5 7))", 60.0);
55
56 test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((2 1,3 4))", 9.0);
57 test_geometry<bg::model::box<P2dc> >("POLYGON((0 1,2 4))", "POLYGON((2 4,3 5))", 12.0);
58
59 test_large_integers();
60
61 return 0;
62 }