]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/overlay/get_turns_linear_linear.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / overlay / get_turns_linear_linear.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
7
8 // This file was modified by Oracle on 2014-2021.
9 // Modifications copyright (c) 2014-2021 Oracle and/or its affiliates.
10 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
11
12 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
13 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
14
15 // Use, modification and distribution is subject to the Boost Software License,
16 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
17 // http://www.boost.org/LICENSE_1_0.txt)
18
19 #include "test_get_turns.hpp"
20 #include <boost/geometry/geometries/geometries.hpp>
21
22
23 template <typename T>
24 void test_all()
25 {
26 typedef bg::model::point<T, 2, bg::cs::cartesian> pt;
27 typedef bg::model::linestring<pt> ls;
28 typedef bg::model::multi_linestring<ls> mls;
29
30 // NOTE: currently for the first endpoint of the Linestring on collinear segment
31 // is_collinear flags are set to FALSE!
32 // E.g. in the first test tii++, NOT tii==
33
34 test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,2 0)", "tii++", "txx==");
35 test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(2 0,0 0)", "tix+=", "txi=+");
36
37 test_geometry<ls, ls>("LINESTRING(1 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
38 test_geometry<ls, ls>("LINESTRING(1 0,0 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tiu+=");
39 test_geometry<ls, ls>("LINESTRING(1 0,2 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txx==");
40 test_geometry<ls, ls>("LINESTRING(1 1,1 0)", "LINESTRING(0 0,1 0,2 0)", "txu++");
41 test_geometry<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txu==");
42 test_geometry<ls, ls>("LINESTRING(2 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tix+=");
43
44 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,1 1)", "tuu++");
45 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,0 0)", "tix+=", "tui=+");
46 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,2 0)", "tii++", "txx==");
47 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 1,1 0)", "tux++");
48 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(0 0,1 0)", "tii++", "tux==");
49 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(2 0,1 0)", "tix+=", "txi=+");
50
51 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,3 0,3 1)", "mii++", "ccc==", "muu==");
52 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,3 0,3 -1)", "mii++", "ccc==", "muu==");
53 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,1 0,1 1)", "miu+=", "mui=+");
54 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,1 0,1 -1)", "miu+=", "mui=+");
55 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 1,2 0,4 0,4 1)", "tii++", "ccc==", "tuu==");
56 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 -1,2 0,4 0,4 -1)", "tii++", "ccc==", "tuu==");
57 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 1,4 0,2 0,2 1)", "tiu+=", "tui=+");
58 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 -1,4 0,2 0,2 -1)", "tiu+=", "tui=+");
59
60 // same as above - TODO: reverse manually or automatically for all tests
61 /*test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,2 0,3 0,3 1)", "mii", "ecc", "muu");
62 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,2 0,3 0,3 -1)", "mii", "ecc", "muu");
63 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,2 0,1 0,1 1)", "miu", "ecc", "mui");
64 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,2 0,1 0,1 -1)", "miu", "ecc", "mui");
65 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 1,2 0,3 0,4 0,4 1)", "tii", "ecc", "tuu");
66 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(2 -1,2 0,3 0,4 0,4 -1)", "tii", "ecc", "tuu");
67 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 1,4 0,3 0,2 0,2 1)", "tiu", "ecc", "tui");
68 test_geometry<ls, ls>("LINESTRING(0 0,2 0,3 0,4 0,6 0)", "LINESTRING(4 -1,4 0,3 0,2 0,2 -1)", "tiu", "ecc", "tui");*/
69
70 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 1,3 5,4 0)", "LINESTRING(1 0,2 1,3 5)", "tii++", "ecc==", "tux==");
71 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 1,3 5,4 0)", "LINESTRING(3 5,2 1,1 0)", "tix+=", "ecc==", "tui=+");
72 test_geometry<ls, ls>("LINESTRING(1 0,2 1,3 5)", "LINESTRING(0 0,1 0,2 1,3 5,4 0)", "txu==", "ecc==", "tii++");
73 test_geometry<ls, ls>("LINESTRING(3 5,2 1,1 0)", "LINESTRING(0 0,1 0,2 1,3 5,4 0)", "tiu+=", "ecc==", "txi=+");
74
75 test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(-1 -1,1 0,10 0,20 -1)", "mii++", "txu==");
76 test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(20 -1,10 0,1 0,-1 -1)", "miu+=", "txi=+");
77 test_geometry<ls, ls>("LINESTRING(-1 -1,1 0,10 0,20 -1)", "LINESTRING(0 0,10 0)", "mii++", "tux==");
78 test_geometry<ls, ls>("LINESTRING(20 -1,10 0,1 0,-1 -1)", "LINESTRING(0 0,10 0)", "mui=+", "tix+=");
79
80 test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)",
81 "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)",
82 expected("tii++")("ecc==")("muu==")("mii++")("muu==")("mii++")("mux=="));
83 test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)",
84 "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
85 expected("tiu+=")("ecc==")("mui=+")("miu+=")("mui=+")("miu+=")("mui=+"));
86 test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)",
87 "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)",
88 expected("tui=+")("ecc==")("miu+=")("mui=+")("miu+=")("mui=+")("mix+="));
89 test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)",
90 "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
91 expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++"));
92
93 test_geometry<ls, ls>("LINESTRING(-1 0,1 0,2 1,3 2)", "LINESTRING(4 5,3 2,1 0,0 0)", "mix+=", "txi=+", "ecc==");
94 test_geometry<ls, ls>("LINESTRING(4 5,3 2,1 0,0 0)", "LINESTRING(-1 0,1 0,2 1,3 2)", "mxi=+", "tix+=", "ecc==");
95
96 test_geometry<ls, ls>("LINESTRING(30 1,20 1,10 0,0 0)", "LINESTRING(1 1,2 0,3 1,20 1,25 1)", "mix+=", "tui=+", "muu++");
97 test_geometry<ls, ls>("LINESTRING(1 1,2 0,3 1,20 1,25 1)", "LINESTRING(30 1,20 1,10 0,0 0)", "mxi=+", "tiu+=", "muu++");
98
99 test_geometry<ls, ls>("LINESTRING(0 0,30 0)", "LINESTRING(4 0,4 1,20 1,5 0,1 0)", "muu++", "mui=+", "mix+=");
100 test_geometry<ls, ls>("LINESTRING(4 0,4 1,20 1,5 0,1 0)", "LINESTRING(0 0,30 0)", "muu++", "miu+=", "mxi=+");
101
102 test_geometry<ls, ls>("LINESTRING(30 0,0 0)", "LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)",
103 expected("mui=+")("miu+=")("mui=+")("mix+="));
104 test_geometry<ls, ls>("LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)", "LINESTRING(30 0,0 0)",
105 expected("miu+=")("mui=+")("miu+=")("mxi=+"));
106
107 test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,4 -1)",
108 expected("mii++")("iuu++")("muu=="));
109 test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,5 0,4 1)",
110 expected("mii++")("muu++")("muu=="));
111
112 // non-collinear
113 test_geometry<ls, ls>("LINESTRING(0 1,0 0)", "LINESTRING(0 0,1 0,2 0)", "txu++");
114 test_geometry<ls, ls>("LINESTRING(0 1,0 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
115 test_geometry<ls, ls>("LINESTRING(0 1,1 0,2 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
116
117 // SPIKE - NON-ENDPOINT - NON-OPPOSITE
118
119 // spike - neq eq
120 test_geometry<ls, ls>("LINESTRING(2 2,4 4,1 1)", "LINESTRING(0 0,4 4,6 3)",
121 expected("mii++")("txu==")("tiu==")("mxi=+"));
122 // spike - eq eq
123 test_geometry<ls, ls>("LINESTRING(0 0,4 4,1 1)", "LINESTRING(0 0,4 4,6 3)",
124 expected("tii++")("txu==")("tiu==")("mxi=+"));
125 // spike - eq neq
126 test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(0 0,4 4,6 3)",
127 expected("tii++")("mxu==")("miu==")("mxi=+"));
128 // spike - neq neq
129 test_geometry<ls, ls>("LINESTRING(1 1,3 3,2 2)", "LINESTRING(0 0,4 4,6 3)",
130 expected("mii++")("mxu==")("miu==")("mxi=+"));
131 // spike - out neq
132 test_geometry<ls, ls>("LINESTRING(0 0,3 3,2 2)", "LINESTRING(1 1,4 4,6 3)",
133 expected("mii++")("mxu==")("miu==")("mxi=+"));
134 // spike - out eq
135 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(1 1,4 4,6 3)",
136 expected("mii++")("txu==")("tiu==")("mxi=+"));
137 // spike - out out/eq
138 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(1 0,4 4,6 3)",
139 expected("tuu++"));
140 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(0 1,4 4,6 3)",
141 expected("tuu++"));
142 // spike - out out/neq
143 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(4 0,4 5,6 3)",
144 expected("muu++"));
145 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(0 4,5 4,6 3)",
146 expected("muu++"));
147
148 // SPIKE - NON-ENDPOINT - OPPOSITE
149
150 // opposite - eq eq
151 test_geometry<ls, ls>("LINESTRING(6 6,4 4,0 0,2 2)", "LINESTRING(-1 -1,0 0,4 4,6 3)",
152 expected("tiu+=")("txi=+")("tii=+")("mxu=="));
153 test_geometry<ls, ls>("LINESTRING(-1 -1,0 0,4 4,6 3)", "LINESTRING(6 6,4 4,0 0,2 2)",
154 expected("tui=+")("tix+=")("tii+=")("mux=="));
155 // opposite - neq eq
156 test_geometry<ls, ls>("LINESTRING(6 6,4 4,0 0,2 2)", "LINESTRING(-1 -1,0 0,5 5,6 3)",
157 expected("miu+=")("txi=+")("tii=+")("mxu=="));
158 // opposite - eq neq
159 test_geometry<ls, ls>("LINESTRING(6 6,4 4,0 0,2 2)", "LINESTRING(-2 -2,-1 -1,4 4,6 3)",
160 expected("tiu+=")("mxi=+")("mii=+")("mxu=="));
161 // opposite - neq neq
162 test_geometry<ls, ls>("LINESTRING(6 6,4 4,0 0,2 2)", "LINESTRING(-2 -2,-1 -1,3 3,6 3)",
163 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
164 // opposite - neq neq
165 test_geometry<ls, ls>("LINESTRING(6 6,4 4,0 0,2 2)", "LINESTRING(-2 -2,-1 -1,3 3,5 5,6 3)",
166 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
167 // opposite - neq eq
168 test_geometry<ls, ls>("LINESTRING(6 3,3 3,0 0)", "LINESTRING(0 0,2 2,3 3,1 1)",
169 expected("txi=+")("tix+=")("tii+=")("mux=="));
170
171 // SPIKE - ENDPOINT - NON-OPPOSITE
172
173 // spike - neq eq
174 test_geometry<ls, ls>("LINESTRING(2 2,4 4,1 1)", "LINESTRING(0 0,4 4)",
175 expected("mii++")("txx==")("tix==")("mxi=+"));
176 test_geometry<ls, ls>("LINESTRING(2 2,4 4,1 1)", "LINESTRING(4 4,0 0)",
177 expected("miu+=")("txi=+")("tii=+")("mxu=="));
178 // spike - eq eq
179 test_geometry<ls, ls>("LINESTRING(0 0,4 4,1 1)", "LINESTRING(0 0,4 4)",
180 expected("tii++")("txx==")("tix==")("mxi=+"));
181 test_geometry<ls, ls>("LINESTRING(0 0,4 4,1 1)", "LINESTRING(4 4,0 0)",
182 expected("tix+=")("txi=+")("tii=+")("mxu=="));
183 // spike - eq neq
184 test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(0 0,4 4)",
185 expected("tii++")("mxu==")("miu==")("mxi=+"));
186 test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(4 4,0 0)",
187 expected("tix+=")("mxi=+")("mii=+")("mxu=="));
188 // spike - neq neq
189 test_geometry<ls, ls>("LINESTRING(1 1,3 3,2 2)", "LINESTRING(0 0,4 4)",
190 expected("mii++")("mxu==")("miu==")("mxi=+"));
191 test_geometry<ls, ls>("LINESTRING(1 1,3 3,2 2)", "LINESTRING(4 4,0 0)",
192 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
193 // spike - out neq
194 test_geometry<ls, ls>("LINESTRING(0 0,3 3,2 2)", "LINESTRING(1 1,4 4)",
195 expected("mii++")("mxu==")("miu==")("mxi=+"));
196 test_geometry<ls, ls>("LINESTRING(0 0,3 3,2 2)", "LINESTRING(4 4,1 1)",
197 expected("mix+=")("mxi=+")("mii=+")("mxu=="));
198 // spike - out eq
199 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(1 1,4 4)",
200 expected("mii++")("txx==")("tix==")("mxi=+"));
201 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(4 4,1 1)",
202 expected("mix+=")("txi=+")("tii=+")("mxu=="));
203 // spike - out out/eq
204 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(1 0,4 4)",
205 expected("tux++"));
206 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(0 1,4 4)",
207 expected("tux++"));
208 // spike - out out/neq
209 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(4 0,4 5)",
210 expected("muu++"));
211 test_geometry<ls, ls>("LINESTRING(0 0,4 4,2 2)", "LINESTRING(0 4,5 4)",
212 expected("muu++"));
213
214 // 29.01.2015
215 if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
216 {
217 // FAILING - possibly wrong IPs
218 test_geometry<ls, ls>("LINESTRING(3 -0.6,0 -0.9)",
219 "LINESTRING(4 2.232432,1 -0.8,9 0)",
220 expected("mui=+")("miu+="));
221
222 test_geometry<ls, ls>("LINESTRING(3 -0.6,1 -0.8,0 -0.9)",
223 "LINESTRING(4 2.232432,1 -0.8,9 0)",
224 expected("tui=+")("miu+="));
225
226 test_geometry<ls, ls>("LINESTRING(3 -0.6, 0 -0.9, -1 -1)",
227 "LINESTRING(4 2.232432, 0 -0.9, 9 0)",
228 expected("tui=+")("miu+="));
229
230 test_geometry<ls, ls>("LINESTRING(3 -0.6, 0 -0.9, -1 -1, -2 -2)",
231 "LINESTRING(4 2.232432,-1 -1, 0 -0.9, 9 0)",
232 expected("tui=+")("ecc==")("miu+="));
233 }
234
235 test_geometry<ls, ls>("LINESTRING(3 0,0 0)",
236 "LINESTRING(4 2,1 0,9 0)",
237 expected("mui=+")("miu+="));
238
239
240 // 01.02.2015
241 test_geometry<ls, ls>("LINESTRING(6 0,0 0,5 0)",
242 "LINESTRING(2 0,0 0,-10 0)",
243 expected("mii++")("txu==")("tiu==")("mui=+"));
244 // the reversal could be automatic...
245 test_geometry<ls, ls>("LINESTRING(2 0,0 0,-10 0)",
246 "LINESTRING(6 0,0 0,5 0)",
247 expected("mii++")("tux==")("tui==")("miu+="));
248 // sanity check
249 test_geometry<ls, ls>("LINESTRING(6 0,0 0)",
250 "LINESTRING(2 0,0 0,-10 0)",
251 expected("mii++")("txu=="));
252 test_geometry<ls, ls>("LINESTRING(0 0,5 0)",
253 "LINESTRING(2 0,0 0,-10 0)",
254 expected("tiu+=")("mui=+"));
255
256 // 03.02.2015
257 test_geometry<ls, ls>("LINESTRING(-7 -8,3 0,4 -1,-7 10)",
258 "LINESTRING(-5 -4,3 0,4 -1,7 -4,2 -1)",
259 expected("tii++")("txu==")("tiu==")("mui=+"));
260 test_geometry<ls, ls>("LINESTRING(-7 -8,3 0,4 -1,-7 10)",
261 "LINESTRING(-5 -4,3 0,7 -4,2 -1)",
262 expected("tii++")("mxu==")("miu==")("mui=+"));
263
264 if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) )
265 {
266 // BUG - the operations are correct but IP coordinates are wrong
267 // ok now also the 3rd turn is wrong
268 #ifdef BOOST_GEOMETRY_TEST_FAILURES
269 test_geometry<ls, ls>("LINESTRING(8 5,5 1,-2 3,1 10)",
270 "LINESTRING(1.9375 1.875, 1.7441860465116283 1.9302325581395348, -0.7692307692307692 2.6483516483516487, -2 3, -1.0071942446043165 5.316546762589928)",
271 expected("mii++")("ccc==")("ccc==")("mux=="));
272 // Now tii++ is generated instead of ccc==
273
274 test_geometry<ls, ls>("LINESTRING(8 5,5 1,-2 3,1 10)",
275 "LINESTRING(1.9375 1.875, 1.7441860465116283 1.9302325581395348, -0.7692307692307692 2.6483516483516487, -2 3, -0.5 6.5)",
276 expected("mii++")("ccc==")("ccc==")("mux=="));
277 // Now tii++ is generated instead of ccc==
278
279 #endif
280
281 test_geometry<ls, ls>("LINESTRING(-0.5 7,8 1,0 -0.2)",
282 "LINESTRING(2 8,4 0.4,8 1,0 5)",
283 expected("iuu++")("mui=+")("tiu+="));
284
285 #ifdef BOOST_GEOMETRY_TEST_FAILURES
286 test_geometry<ls, ls>("LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)",
287 "LINESTRING(31 -97, -46 57, -20 -4)",
288 expected("iuu++"));
289 test_geometry<ls, ls>("LINESTRING(31 -97, -46 57, -20 -4)",
290 "LINESTRING(-2305843009213693956 4611686018427387906, -33 -92, 78 83)",
291 expected("iuu++"));
292 #endif
293 }
294
295 // In 1.57 the results of those combinations was different for MinGW
296 // (probably also QCC and GCC5.0) and MSVC/GCC. The results was depending
297 // on the instructions generated by the compiler when calculating the
298 // determinants.
299 // See also: https://svn.boost.org/trac/boost/ticket/8379
300 // https://github.com/boostorg/geometry/pull/259
301 if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
302 {
303 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
304 "LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)",
305 expected("mii++")("ccc==")("mux=="));
306 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 110 1)",
307 "LINESTRING(12 10, 13 0.03, 14 0.04, 15 0.05)",
308 expected("mii++")("ccc==")("mux=="));
309 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 110 1)",
310 "LINESTRING(102 10, 103 0.93, 104 0.94, 105 0.95)",
311 expected("mii++")("ccc==")("mux=="));
312 test_geometry<ls, ls>("LINESTRING(100 0, 110 0, 120 1)",
313 "LINESTRING(112 10, 113 0.3, 114 0.4, 115 0.5)",
314 expected("mii++")("ccc==")("mux=="));
315 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
316 "LINESTRING(15 0.5, 14 0.4, 13 0.3, 12 10)",
317 expected("miu+=")("mui=+"));
318 test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
319 "LINESTRING(12 10, 13 0.3, 14 0.4, 15 0.5)",
320 expected("mui=+")("mix+="));
321 test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
322 "LINESTRING(15 0.5, 14 0.4, 13 0.3, 12 10)",
323 expected("muu==")("ccc==")("mii++"));
324
325 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
326 "LINESTRING(13 0.3, 14 0.4, 15 0.5)",
327 expected("mii++")("ccc==")("mux=="));
328 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
329 "LINESTRING(15 0.5, 14 0.4, 13 0.3)",
330 expected("mix+=")("mui=+"));
331 test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
332 "LINESTRING(13 0.3, 14 0.4, 15 0.5)",
333 expected("mui=+")("mix+="));
334 test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
335 "LINESTRING(15 0.5, 14 0.4, 13 0.3)",
336 expected("mux==")("ccc==")("mii++"));
337
338 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
339 "LINESTRING(12 10, 13 0.3, 14 0.4)",
340 expected("mii++")("mux=="));
341 test_geometry<ls, ls>("LINESTRING(0 0, 10 0, 20 1)",
342 "LINESTRING(14 0.4, 13 0.3, 12 10)",
343 expected("miu+=")("mui=+"));
344 test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
345 "LINESTRING(12 10, 13 0.3, 14 0.4)",
346 expected("mui=+")("mix+="));
347 test_geometry<ls, ls>("LINESTRING(20 1, 10 0, 0 0)",
348 "LINESTRING(14 0.4, 13 0.3, 12 10)",
349 expected("muu==")("mii++"));
350 }
351
352 // TODO:
353 //test_geometry<ls, ls>("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
354 //test_geometry<ls, ls>("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
355
356 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(3 0,3 3,3 1)", "0F1FF0102");
357 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 3,2 1)", "0F1FF0102");
358 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 2,2 1)", "0F1FF0102");
359
360 //test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2");
361
362
363 // duplicated
364 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,30 0))",
365 "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0),(2 0,2 0),(3 0,3 0,3 0))",
366 expected("mii++")("ccc==")("ccc==")("txx=="));
367
368 // spike
369 test_geometry<ls, ls>("LINESTRING(2 2,5 -1,15 2,18 0,20 0)",
370 "LINESTRING(30 0,19 0,18 0,0 0)",
371 expected("iuu++")("iuu++")("tiu+=")("mxi=+"));
372 // spike
373 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
374 "MULTILINESTRING((1 0,8 0,4 0))",
375 expected("mii++")("mix+=")("mux==")("mui==")("mix+=")("mii+=")("mxu==")("mxi=+"));
376
377 /*test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
378 "MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))",
379 expected("mii")("ccc")("ccc")("txx"));*/
380
381 // spike vs endpoint
382 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
383 "MULTILINESTRING((-1 0,0 0,-2 0),(11 0,10 0,12 0))",
384 expected("tuu++")("txu++"));
385 // internal turning R vs spike
386 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
387 "MULTILINESTRING((0 1,1 1,0 1))",
388 expected("tuu++"));
389 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
390 "MULTILINESTRING((1 2,1 1,1 2))",
391 expected("tuu++"));
392 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 0,0 0))",
393 "MULTILINESTRING((2 0,1 0,2 0))",
394 expected("tuu++"));
395 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
396 "MULTILINESTRING((0 2,1 1,0 2))",
397 expected("tuu++"));
398 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
399 "MULTILINESTRING((2 0,1 1,2 0))",
400 expected("tuu++"));
401 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
402 "MULTILINESTRING((2 1,1 1,2 1))",
403 expected("txi=+")("tix+=")("tii+=")("txx=="));
404 // internal turning L vs spike
405 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
406 "MULTILINESTRING((2 1,1 1,2 1))",
407 expected("tuu++"));
408 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
409 "MULTILINESTRING((1 2,1 1,1 2))",
410 expected("tuu++"));
411 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
412 "MULTILINESTRING((2 2,1 1,2 2))",
413 expected("tuu++"));
414 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
415 "MULTILINESTRING((0 0,1 1,0 0))",
416 expected("tuu++"));
417 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
418 "MULTILINESTRING((0 1,1 1,0 1))",
419 expected("txi=+")("tix+=")("tii+=")("txx=="));
420 // spike vs internal turning R
421 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
422 "MULTILINESTRING((1 0,1 1,2 1))",
423 expected("tuu++"));
424 test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))",
425 "MULTILINESTRING((1 0,1 1,2 1))",
426 expected("tuu++"));
427 test_geometry<mls, mls>("MULTILINESTRING((2 0,1 0,2 0))",
428 "MULTILINESTRING((0 0,1 0,0 0))",
429 expected("tuu++"));
430 test_geometry<mls, mls>("MULTILINESTRING((0 2,1 1,0 2))",
431 "MULTILINESTRING((1 0,1 1,2 1))",
432 expected("tuu++"));
433 test_geometry<mls, mls>("MULTILINESTRING((2 0,1 1,2 0))",
434 "MULTILINESTRING((1 0,1 1,2 1))",
435 expected("tuu++"));
436 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))",
437 "MULTILINESTRING((1 0,1 1,2 1))",
438 expected("tix+=")("txi=+")("tii=+")("txx=="));
439 // spike vs internal turning L
440 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))",
441 "MULTILINESTRING((1 0,1 1,0 1))",
442 expected("tuu++"));
443 test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))",
444 "MULTILINESTRING((1 0,1 1,0 1))",
445 expected("tuu++"));
446 test_geometry<mls, mls>("MULTILINESTRING((2 2,1 1,2 2))",
447 "MULTILINESTRING((1 0,1 1,0 1))",
448 expected("tuu++"));
449 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
450 "MULTILINESTRING((1 0,1 1,0 1))",
451 expected("tuu++"));
452 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
453 "MULTILINESTRING((1 0,1 1,0 1))",
454 expected("tix+=")("txi=+")("tii=+")("txx=="));
455 // spike vs internal collinear
456 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
457 "MULTILINESTRING((2 1,1 1,0 1))",
458 expected("tix+=")("txi=+")("tii=+")("txx=="));
459 // internal collinear vs spike
460 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,0 1))",
461 "MULTILINESTRING((0 1,1 1,0 1))",
462 expected("txi=+")("tix+=")("tii+=")("txx=="));
463 // spike vs spike
464 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
465 "MULTILINESTRING((2 2,1 1,2 2))",
466 expected("tuu++"));
467 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
468 "MULTILINESTRING((2 0,1 1,2 0))",
469 expected("tuu++"));
470 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
471 "MULTILINESTRING((2 1,1 1,2 1))",
472 expected("tuu++"));
473 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
474 "MULTILINESTRING((0 1,1 1,0 1))",
475 expected("tuu++"));
476 // collinear spikes
477 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
478 "MULTILINESTRING((0 0,1 1,0 0))",
479 expected("tii++")("tix+=")("txi=+")("txx==")
480 ("ecc=="));
481 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
482 "MULTILINESTRING((1 1,0 0,1 1))",
483 expected("tix+=")("tii+=")("txx==")("txi==")
484 ("txi=+")("tii=+")("txx==")("tix=="));
485 // non-spike similar
486 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
487 "MULTILINESTRING((-1 0,0 0,2 0))",
488 expected("tii++")("mux=="));
489 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
490 "MULTILINESTRING((-1 -1,0 0,2 0))",
491 expected("tii++")("mux=="));
492 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
493 "MULTILINESTRING((2 0,0 0,-1 0))",
494 expected("tiu+=")("mui=+"));
495 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
496 "MULTILINESTRING((2 0,0 0,-1 -1))",
497 expected("tiu+=")("mui=+"));
498
499 // parts of boundaries taken from union A/A buffer_mp1
500 if ( BOOST_GEOMETRY_CONDITION((std::is_same<T, double>::value)) )
501 {
502 test_geometry<ls, ls>("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)",
503 "LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7.000000000000001 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)",
504 expected("tuu++"));
505 // the above should give the same result as this:
506 test_geometry<ls, ls>("LINESTRING(6.95629520146761 5.415823381635526,6.989043790736545 5.209056926535316,7 5,6.989043790736547 4.790943073464693,6.956295201467611 4.584176618364482)",
507 "LINESTRING(7.415823381635519 5.043704798532389,7.209056926535308 5.010956209263453,7 5,6.790943073464693 5.010956209263453,6.584176618364483 5.043704798532389)",
508 expected("tuu++"));
509 }
510 }
511
512 int test_main(int, char* [])
513 {
514 test_all<float>();
515 test_all<double>();
516
517 #if ! defined(_MSC_VER)
518 test_all<long double>();
519 #endif
520
521 return 0;
522 }
523