]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/set_operations/intersection/intersection_pl_pl.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / set_operations / intersection / intersection_pl_pl.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2014-2015, Oracle and/or its affiliates.
4
5 // Licensed under the Boost Software License version 1.0.
6 // http://www.boost.org/users/license.html
7
8 // Contributed and/or modified by Menelaos Karavelas, on behalf of Oracle
9
10 #include <iostream>
11
12 #ifndef BOOST_TEST_MODULE
13 #define BOOST_TEST_MODULE test_intersection_pointlike_pointlike
14 #endif
15
16 #ifdef BOOST_GEOMETRY_TEST_DEBUG
17 #define BOOST_GEOMETRY_DEBUG_TURNS
18 #define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
19 #endif
20
21 #include <boost/test/included/unit_test.hpp>
22
23 #include "../test_set_ops_pointlike.hpp"
24
25 #include <boost/geometry/geometries/multi_point.hpp>
26
27 typedef bg::model::point<double,2,bg::cs::cartesian> point_type;
28 typedef bg::model::multi_point<point_type> multi_point_type;
29
30
31
32 //===========================================================================
33 //===========================================================================
34 //===========================================================================
35
36
37 BOOST_AUTO_TEST_CASE( test_intersection_point_point )
38 {
39 #ifdef BOOST_GEOMETRY_TEST_DEBUG
40 std::cout << std::endl << std::endl << std::endl;
41 std::cout << "*** POINT / POINT INTERSECTION ***" << std::endl;
42 std::cout << std::endl;
43 #endif
44
45 typedef point_type P;
46 typedef multi_point_type MP;
47
48 typedef test_set_op_of_pointlike_geometries
49 <
50 P, P, MP, bg::overlay_intersection
51 > tester;
52
53 tester::apply
54 ("ppi01",
55 from_wkt<P>("POINT(0 0)"),
56 from_wkt<P>("POINT(1 1)"),
57 from_wkt<MP>("MULTIPOINT()")
58 );
59
60 tester::apply
61 ("ppi02",
62 from_wkt<P>("POINT(0 0)"),
63 from_wkt<P>("POINT(0 0)"),
64 from_wkt<MP>("MULTIPOINT(0 0)")
65 );
66 }
67
68
69 BOOST_AUTO_TEST_CASE( test_intersection_multipoint_point )
70 {
71 #ifdef BOOST_GEOMETRY_TEST_DEBUG
72 std::cout << std::endl << std::endl << std::endl;
73 std::cout << "*** MULTIPOINT / POINT INTERSECTION ***" << std::endl;
74 std::cout << std::endl;
75 #endif
76
77 typedef point_type P;
78 typedef multi_point_type MP;
79
80 typedef test_set_op_of_pointlike_geometries
81 <
82 MP, P, MP, bg::overlay_intersection
83 > tester;
84
85 tester::apply
86 ("mppi01",
87 from_wkt<MP>("MULTIPOINT(0 0)"),
88 from_wkt<P>("POINT(1 1)"),
89 from_wkt<MP>("MULTIPOINT()")
90 );
91
92 tester::apply
93 ("mppi02",
94 from_wkt<MP>("MULTIPOINT(0 0)"),
95 from_wkt<P>("POINT(0 0)"),
96 from_wkt<MP>("MULTIPOINT(0 0)")
97 );
98
99 tester::apply
100 ("mppi03",
101 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
102 from_wkt<P>("POINT(1 1)"),
103 from_wkt<MP>("MULTIPOINT()")
104 );
105
106 tester::apply
107 ("mppi04",
108 from_wkt<MP>("MULTIPOINT(0 0,0 0)"),
109 from_wkt<P>("POINT(0 0)"),
110 from_wkt<MP>("MULTIPOINT(0 0)")
111 );
112
113 tester::apply
114 ("mppi05",
115 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
116 from_wkt<P>("POINT(1 1)"),
117 from_wkt<MP>("MULTIPOINT()")
118 );
119
120 tester::apply
121 ("mppi06",
122 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
123 from_wkt<P>("POINT(1 0)"),
124 from_wkt<MP>("MULTIPOINT(1 0)")
125 );
126
127 tester::apply
128 ("mppi07",
129 from_wkt<MP>("MULTIPOINT(0 0,0 0,1 0)"),
130 from_wkt<P>("POINT(0 0)"),
131 from_wkt<MP>("MULTIPOINT(0 0)")
132 );
133
134 tester::apply
135 ("mppi08",
136 from_wkt<MP>("MULTIPOINT()"),
137 from_wkt<P>("POINT(0 0)"),
138 from_wkt<MP>("MULTIPOINT()")
139 );
140 }
141
142
143 BOOST_AUTO_TEST_CASE( test_intersection_multipoint_multipoint )
144 {
145 #ifdef BOOST_GEOMETRY_TEST_DEBUG
146 std::cout << std::endl << std::endl << std::endl;
147 std::cout << "*** MULTIPOINT / MULTIPOINT INTERSECTION ***" << std::endl;
148 std::cout << std::endl;
149 #endif
150
151 typedef multi_point_type MP;
152
153 typedef test_set_op_of_pointlike_geometries
154 <
155 MP, MP, MP, bg::overlay_intersection
156 > tester;
157
158 tester::apply
159 ("mpmpi01",
160 from_wkt<MP>("MULTIPOINT(2 2,3 3,0 0,0 0,2 2,1 1,1 1,1 0,1 0)"),
161 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1)"),
162 from_wkt<MP>("MULTIPOINT(1 0,1 1,1 1,1 1)")
163 );
164
165 tester::apply
166 ("mpmp02",
167 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
168 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
169 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
170 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)")
171 );
172
173 tester::apply
174 ("mpmpi03",
175 from_wkt<MP>("MULTIPOINT()"),
176 from_wkt<MP>("MULTIPOINT(1 0,0 0,1 1,0 0)"),
177 from_wkt<MP>("MULTIPOINT()")
178 );
179
180 tester::apply
181 ("mpmpi04",
182 from_wkt<MP>("MULTIPOINT(0 0,1 1,1 0,1 1)"),
183 from_wkt<MP>("MULTIPOINT()"),
184 from_wkt<MP>("MULTIPOINT()")
185 );
186
187 tester::apply
188 ("mpmpi05",
189 from_wkt<MP>("MULTIPOINT()"),
190 from_wkt<MP>("MULTIPOINT()"),
191 from_wkt<MP>("MULTIPOINT()")
192 );
193
194 tester::apply
195 ("mpmpi06",
196 from_wkt<MP>("MULTIPOINT(0 0,1 0,2 0,3 0,0 0,1 0,2 0)"),
197 from_wkt<MP>("MULTIPOINT(0 1,0 2,1 0,0 0,2 0)"),
198 from_wkt<MP>("MULTIPOINT(1 0,0 0,2 0)")
199 );
200 }
201