]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/overlay/get_turns_linear_linear_sph.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / overlay / get_turns_linear_linear_sph.cpp
1 // Boost.Geometry
2 // Unit Test
3
4 // Copyright (c) 2016, Oracle and/or its affiliates.
5 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
6
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)
10
11
12 #include "test_get_turns.hpp"
13 #include <boost/geometry/geometries/geometries.hpp>
14
15
16 template <typename T>
17 void test_all()
18 {
19 typedef bg::model::point<T, 2, bg::cs::spherical_equatorial<bg::degree> > pt;
20 typedef bg::model::linestring<pt> ls;
21 typedef bg::model::multi_linestring<ls> mls;
22
23 // NOTE: currently for the first endpoint of the Linestring on collinear segment
24 // is_collinear flags are set to FALSE!
25 // E.g. in the first test tii++, NOT tii==
26
27 test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(0 0,2 0)", "tii++", "txx==");
28 test_geometry<ls, ls>("LINESTRING(0 0,2 0)", "LINESTRING(2 0,0 0)", "tix+=", "txi=+");
29
30 test_geometry<ls, ls>("LINESTRING(1 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
31 test_geometry<ls, ls>("LINESTRING(1 0,0 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tiu+=");
32 test_geometry<ls, ls>("LINESTRING(1 0,2 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txx==");
33 test_geometry<ls, ls>("LINESTRING(1 1,1 0)", "LINESTRING(0 0,1 0,2 0)", "txu++");
34 test_geometry<ls, ls>("LINESTRING(0 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "tii++", "txu==");
35 test_geometry<ls, ls>("LINESTRING(2 0,1 0)", "LINESTRING(0 0,1 0,2 0)", "txi=+", "tix+=");
36
37 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,1 1)", "tuu++");
38 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,0 0)", "tix+=", "tui=+");
39 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 0,2 0)", "tii++", "txx==");
40 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(1 1,1 0)", "tux++");
41 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(0 0,1 0)", "tii++", "tux==");
42 test_geometry<ls, ls>("LINESTRING(0 0,1 0,2 0)", "LINESTRING(2 0,1 0)", "tix+=", "txi=+");
43
44 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 1,1 0,3 0,3 1)", "mii++", "ccc==", "muu==");
45 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(1 -1,1 0,3 0,3 -1)", "mii++", "ccc==", "muu==");
46 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 1,3 0,1 0,1 1)", "miu+=", "mui=+");
47 test_geometry<ls, ls>("LINESTRING(0 0,2 0,4 0)", "LINESTRING(3 -1,3 0,1 0,1 -1)", "miu+=", "mui=+");
48 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==");
49 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==");
50 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=+");
51 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=+");
52
53 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==");
54 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=+");
55 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++");
56 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=+");
57
58 test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(-1 -1,1 0,10 0,20 -1)", "mii++", "txu==");
59 test_geometry<ls, ls>("LINESTRING(0 0,10 0)", "LINESTRING(20 -1,10 0,1 0,-1 -1)", "miu+=", "txi=+");
60 test_geometry<ls, ls>("LINESTRING(-1 -1,1 0,10 0,20 -1)", "LINESTRING(0 0,10 0)", "mii++", "tux==");
61 test_geometry<ls, ls>("LINESTRING(20 -1,10 0,1 0,-1 -1)", "LINESTRING(0 0,10 0)", "mui=+", "tix+=");
62
63 test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)",
64 "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)",
65 expected("tii++")("ecc==")("muu==")("mii++")("muu==")("mii++")("mux=="));
66 test_geometry<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)",
67 "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
68 expected("tiu+=")("ecc==")("mui=+")("miu+=")("mui=+")("miu+=")("mui=+"));
69 test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)",
70 "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)",
71 expected("tui=+")("ecc==")("miu+=")("mui=+")("miu+=")("mui=+")("mix+="));
72 test_geometry<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)",
73 "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)",
74 expected("tuu==")("ecc==")("mii++")("muu==")("mii++")("muu==")("mii++"));
75
76 test_geometry<ls, ls>("LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)",
77 "LINESTRING(4 5,3 2,1 0,0 0)",
78 "mix+=", "txi=+", "ecc==");
79 test_geometry<ls, ls>("LINESTRING(4 5,3 2,1 0,0 0)",
80 "LINESTRING(-1 0,1 0,2 1.0004570537241201524198894179384922,3 2)",
81 "mxi=+", "tix+=", "ecc==");
82
83 test_geometry<ls, ls>("LINESTRING(30 0,20 0,1 1,-1 -1)", "LINESTRING(0 -1,0 0,1 -1,20 0,25 0)", "mix+=", "tui=+", "muu++");
84 test_geometry<ls, ls>("LINESTRING(0 -1,0 0,1 -1,20 0,25 0)", "LINESTRING(30 0,20 0,1 1,-1 -1)", "mxi=+", "tiu+=", "muu++");
85
86 test_geometry<ls, ls>("LINESTRING(0 0,30 0)", "LINESTRING(4 0,4 1,20 1,5 0,1 0)", "muu++", "mui=+", "mix+=");
87 test_geometry<ls, ls>("LINESTRING(4 0,4 1,20 1,5 0,1 0)", "LINESTRING(0 0,30 0)", "muu++", "miu+=", "mxi=+");
88
89 test_geometry<ls, ls>("LINESTRING(30 0,0 0)", "LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)",
90 expected("mui=+")("miu+=")("mui=+")("mix+="));
91 test_geometry<ls, ls>("LINESTRING(1 0,5 0,20 1,4 1,4 0,5 0)", "LINESTRING(30 0,0 0)",
92 expected("miu+=")("mui=+")("miu+=")("mxi=+"));
93
94 test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,4 -1)",
95 expected("mii++")("iuu++")("muu=="));
96 test_geometry<ls, ls>("LINESTRING(1 0,7 0,8 1)", "LINESTRING(0 0,10 0,10 10,5 0,4 1)",
97 expected("mii++")("muu++")("muu=="));
98
99 // non-collinear
100 test_geometry<ls, ls>("LINESTRING(0 1,0 0)", "LINESTRING(0 0,1 0,2 0)", "txu++");
101 test_geometry<ls, ls>("LINESTRING(0 1,0 0,1 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
102 test_geometry<ls, ls>("LINESTRING(0 1,1 0,2 1)", "LINESTRING(0 0,1 0,2 0)", "tuu++");
103
104 // SPIKE - NON-ENDPOINT - NON-OPPOSITE
105
106 // spike - neq eq
107 test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 0,0 4,6 3)",
108 expected("mii++")("txu==")("tiu==")("mxi=+"));
109 // spike - eq eq
110 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 0,0 4,6 3)",
111 expected("tii++")("txu==")("tiu==")("mxi=+"));
112 // spike - eq neq
113 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 0,0 4,6 3)",
114 expected("tii++")("mxu==")("miu==")("mxi=+"));
115 // spike - neq neq
116 test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 0,0 4,6 3)",
117 expected("mii++")("mxu==")("miu==")("mxi=+"));
118 // spike - out neq
119 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 1,0 4,6 3)",
120 expected("mii++")("mxu==")("miu==")("mxi=+"));
121 // spike - out eq
122 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 1,0 4,6 3)",
123 expected("mii++")("txu==")("tiu==")("mxi=+"));
124 // spike - out out/eq
125 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(1 0,0 4,6 3)",
126 expected("tuu++"));
127 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(-1 0,0 4,6 3)",
128 expected("tuu++"));
129 // spike - out out/neq
130 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0,6 3)",
131 expected("muu++"));
132 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0,6 3)",
133 expected("muu++"));
134
135 // SPIKE - NON-ENDPOINT - OPPOSITE
136
137 // opposite - eq eq
138 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -1,0 0,0 4,6 3)",
139 expected("tiu+=")("txi=+")("tii=+")("mxu=="));
140 test_geometry<ls, ls>("LINESTRING(0 -1,0 0,0 4,6 3)", "LINESTRING(0 6,0 4,0 0,0 2)",
141 expected("tui=+")("tix+=")("tii+=")("mux=="));
142 // opposite - neq eq
143 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -1,0 0,0 5,6 3)",
144 expected("miu+=")("txi=+")("tii=+")("mxu=="));
145 // opposite - eq neq
146 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 4,6 3)",
147 expected("tiu+=")("mxi=+")("mii=+")("mxu=="));
148 // opposite - neq neq
149 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 3,6 3)",
150 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
151 // opposite - neq neq
152 test_geometry<ls, ls>("LINESTRING(0 6,0 4,0 0,0 2)", "LINESTRING(0 -2,0 -1,0 3,0 5,6 3)",
153 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
154 // opposite - neq eq
155 test_geometry<ls, ls>("LINESTRING(6 3,0 3,0 0)", "LINESTRING(0 0,0 2,0 3,0 1)",
156 expected("txi=+")("tix+=")("tii+=")("mux=="));
157
158 // SPIKE - ENDPOINT - NON-OPPOSITE
159
160 // spike - neq eq
161 test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 0,0 4)",
162 expected("mii++")("txx==")("tix==")("mxi=+"));
163 test_geometry<ls, ls>("LINESTRING(0 2,0 4,0 1)", "LINESTRING(0 4,0 0)",
164 expected("miu+=")("txi=+")("tii=+")("mxu=="));
165 // spike - eq eq
166 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 0,0 4)",
167 expected("tii++")("txx==")("tix==")("mxi=+"));
168 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 1)", "LINESTRING(0 4,0 0)",
169 expected("tix+=")("txi=+")("tii=+")("mxu=="));
170 // spike - eq neq
171 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 0,0 4)",
172 expected("tii++")("mxu==")("miu==")("mxi=+"));
173 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 1)", "LINESTRING(0 4,0 0)",
174 expected("tix+=")("mxi=+")("mii=+")("mxu=="));
175 // spike - neq neq
176 test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 0,0 4)",
177 expected("mii++")("mxu==")("miu==")("mxi=+"));
178 test_geometry<ls, ls>("LINESTRING(0 1,0 3,0 2)", "LINESTRING(0 4,0 0)",
179 expected("miu+=")("mxi=+")("mii=+")("mxu=="));
180 // spike - out neq
181 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 1,0 4)",
182 expected("mii++")("mxu==")("miu==")("mxi=+"));
183 test_geometry<ls, ls>("LINESTRING(0 0,0 3,0 2)", "LINESTRING(0 4,0 1)",
184 expected("mix+=")("mxi=+")("mii=+")("mxu=="));
185 // spike - out eq
186 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 1,0 4)",
187 expected("mii++")("txx==")("tix==")("mxi=+"));
188 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(0 4,0 1)",
189 expected("mix+=")("txi=+")("tii=+")("mxu=="));
190 // spike - out out/eq
191 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(1 0,0 4)",
192 expected("tux++"));
193 test_geometry<ls, ls>("LINESTRING(0 0,0 4,0 2)", "LINESTRING(-1 0,0 4)",
194 expected("tux++"));
195 // spike - out out/neq
196 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(-1 0,1 0)",
197 expected("muu++"));
198 test_geometry<ls, ls>("LINESTRING(0 -2,0 0,0 -1)", "LINESTRING(1 0,-1 0)",
199 expected("muu++"));
200
201
202 test_geometry<ls, ls>("LINESTRING(3 0,0 0)",
203 "LINESTRING(4 2,1 0,9 0)",
204 expected("mui=+")("miu+="));
205
206
207 // 01.02.2015
208 test_geometry<ls, ls>("LINESTRING(6 0,0 0,5 0)",
209 "LINESTRING(2 0,0 0,-10 0)",
210 expected("mii++")("txu==")("tiu==")("mui=+"));
211 // the reversal could be automatic...
212 test_geometry<ls, ls>("LINESTRING(2 0,0 0,-10 0)",
213 "LINESTRING(6 0,0 0,5 0)",
214 expected("mii++")("tux==")("tui==")("miu+="));
215 // sanity check
216 test_geometry<ls, ls>("LINESTRING(6 0,0 0)",
217 "LINESTRING(2 0,0 0,-10 0)",
218 expected("mii++")("txu=="));
219 test_geometry<ls, ls>("LINESTRING(0 0,5 0)",
220 "LINESTRING(2 0,0 0,-10 0)",
221 expected("tiu+=")("mui=+"));
222
223 if ( BOOST_GEOMETRY_CONDITION((boost::is_same<T, double>::value)) )
224 {
225 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
226 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
227 expected("mii++")("ccc==")("mux=="));
228 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
229 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392, 12 10)",
230 expected("miu+=")("mui=+"));
231 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
232 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
233 expected("mui=+")("mix+="));
234 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 0)",
235 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392, 12 10)",
236 expected("muu==")("ccc==")("mii++"));
237
238 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
239 "LINESTRING(12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
240 expected("mii++")("ccc==")("mux=="));
241 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
242 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392)",
243 expected("mix+=")("mui=+"));
244 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
245 "LINESTRING(12.5 -0.50051443471392, 15 0, 17.5 0.50051443471392)",
246 expected("mui=+")("mix+="));
247 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
248 "LINESTRING(17.5 0.50051443471392, 15 0, 12.5 -0.50051443471392)",
249 expected("mux==")("ccc==")("mii++"));
250
251 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
252 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0)",
253 expected("mii++")("mux=="));
254 test_geometry<ls, ls>("LINESTRING(0 -1, 10 -1, 20 1)",
255 "LINESTRING(15 0, 12.5 -0.50051443471392, 12 10)",
256 expected("miu+=")("mui=+"));
257 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
258 "LINESTRING(12 10, 12.5 -0.50051443471392, 15 0)",
259 expected("mui=+")("mix+="));
260 test_geometry<ls, ls>("LINESTRING(20 1, 10 -1, 0 -1)",
261 "LINESTRING(15 0, 12.5 -0.50051443471392, 12 10)",
262 expected("muu==")("mii++"));
263 }
264
265 // TODO:
266 //test_geometry<ls, ls>("LINESTRING(0 0,2 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
267 //test_geometry<ls, ls>("LINESTRING(2 0,0 0,1 0)", "LINESTRING(0 1,0 0,2 0)", "1FF00F102");
268
269 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(3 0,3 3,3 1)", "0F1FF0102");
270 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 3,2 1)", "0F1FF0102");
271 //test_geometry<ls, ls>("LINESTRING(0 0,3 3,1 1)", "LINESTRING(2 0,2 2,2 1)", "0F1FF0102");
272
273 //test_geometry<ls, ls>("LINESTRING(0 0,2 2,3 3,4 4)", "LINESTRING(0 0,1 1,4 4)", "1FFF0FFF2");
274
275
276 //if ( boost::is_same<T, double>::value )
277 //{
278 // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(0 0,2 0,2.5 0,3 1)", "test11.svg");
279 // to_svg<ls, ls>("LINESTRING(0 0,1 0,2 0,2.5 0,3 1)", "LINESTRING(3 1,2.5 0,2 0,0 0)", "test12.svg");
280 // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,20 0,30 0,31 1)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "test21.svg");
281 // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,20 0,30 0,31 1)", "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", "test22.svg");
282
283 // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)", "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", "test31.svg");
284 // to_svg<ls, ls>("LINESTRING(-1 1,0 0,1 0,4 0,5 5,10 5,15 0,31 0)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "test32.svg");
285 // to_svg<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)", "LINESTRING(-1 -1,0 0,1 0,2 0,2.5 1,3 0,30 0)", "test33.svg");
286 // to_svg<ls, ls>("LINESTRING(31 0,15 0,10 5,5 5,4 0,1 0,0 0,-1 1)", "LINESTRING(30 0,3 0,2.5 1,2 0,1 0,0 0,-1 -1)", "test34.svg");
287 //}
288
289 // duplicated
290 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,30 0))",
291 "MULTILINESTRING((0 10,5 0,20 0,20 0,30 0),(2 0,2 0),(3 0,3 0,3 0))",
292 expected("mii++")("ccc==")("ccc==")("txx=="));
293
294 // spike
295 test_geometry<ls, ls>("LINESTRING(2 2,5 -1,15 2,18 0,20 0)",
296 "LINESTRING(30 0,19 0,18 0,0 0)",
297 expected("iuu++")("iuu++")("tiu+=")("mxi=+"));
298 // spike
299 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
300 "MULTILINESTRING((1 0,8 0,4 0))",
301 expected("mii++")("mix+=")("mux==")("mui==")("mix+=")("mii+=")("mxu==")("mxi=+"));
302
303 /*test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0,5 0))",
304 "MULTILINESTRING((1 0,8 0,4 0),(2 0,9 0,5 0))",
305 expected("mii")("ccc")("ccc")("txx"));*/
306
307 // spike vs endpoint
308 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
309 "MULTILINESTRING((-1 0,0 0,-2 0),(11 0,10 0,12 0))",
310 expected("tuu++")("txu++"));
311 // internal turning R vs spike
312 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
313 "MULTILINESTRING((0 1,1 1,0 1))",
314 expected("tuu++"));
315 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
316 "MULTILINESTRING((1 2,1 1,1 2))",
317 expected("tuu++"));
318 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 0,0 0))",
319 "MULTILINESTRING((2 0,1 0,2 0))",
320 expected("tuu++"));
321 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
322 "MULTILINESTRING((0 2,1 1,0 2))",
323 expected("tuu++"));
324 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
325 "MULTILINESTRING((2 0,1 1,2 0))",
326 expected("tuu++"));
327 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,2 1))",
328 "MULTILINESTRING((2 1,1 1,2 1))",
329 expected("txi=+")("tix+=")("tii+=")("txx=="));
330 // internal turning L vs spike
331 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
332 "MULTILINESTRING((2 1,1 1,2 1))",
333 expected("tuu++"));
334 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
335 "MULTILINESTRING((1 2,1 1,1 2))",
336 expected("tuu++"));
337 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
338 "MULTILINESTRING((2 2,1 1,2 2))",
339 expected("tuu++"));
340 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
341 "MULTILINESTRING((0 0,1 1,0 0))",
342 expected("tuu++"));
343 test_geometry<mls, mls>("MULTILINESTRING((1 0,1 1,0 1))",
344 "MULTILINESTRING((0 1,1 1,0 1))",
345 expected("txi=+")("tix+=")("tii+=")("txx=="));
346 // spike vs internal turning R
347 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
348 "MULTILINESTRING((1 0,1 1,2 1))",
349 expected("tuu++"));
350 test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))",
351 "MULTILINESTRING((1 0,1 1,2 1))",
352 expected("tuu++"));
353 test_geometry<mls, mls>("MULTILINESTRING((2 0,1 0,2 0))",
354 "MULTILINESTRING((0 0,1 0,0 0))",
355 expected("tuu++"));
356 test_geometry<mls, mls>("MULTILINESTRING((0 2,1 1,0 2))",
357 "MULTILINESTRING((1 0,1 1,2 1))",
358 expected("tuu++"));
359 test_geometry<mls, mls>("MULTILINESTRING((2 0,1 1,2 0))",
360 "MULTILINESTRING((1 0,1 1,2 1))",
361 expected("tuu++"));
362 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))",
363 "MULTILINESTRING((1 0,1 1,2 1))",
364 expected("tix+=")("txi=+")("tii=+")("txx=="));
365 // spike vs internal turning L
366 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,2 1))",
367 "MULTILINESTRING((1 0,1 1,0 1))",
368 expected("tuu++"));
369 test_geometry<mls, mls>("MULTILINESTRING((1 2,1 1,1 2))",
370 "MULTILINESTRING((1 0,1 1,0 1))",
371 expected("tuu++"));
372 test_geometry<mls, mls>("MULTILINESTRING((2 2,1 1,2 2))",
373 "MULTILINESTRING((1 0,1 1,0 1))",
374 expected("tuu++"));
375 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
376 "MULTILINESTRING((1 0,1 1,0 1))",
377 expected("tuu++"));
378 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
379 "MULTILINESTRING((1 0,1 1,0 1))",
380 expected("tix+=")("txi=+")("tii=+")("txx=="));
381 // spike vs internal collinear
382 test_geometry<mls, mls>("MULTILINESTRING((0 1,1 1,0 1))",
383 "MULTILINESTRING((2 1,1 1,0 1))",
384 expected("tix+=")("txi=+")("tii=+")("txx=="));
385 // internal collinear vs spike
386 test_geometry<mls, mls>("MULTILINESTRING((2 1,1 1,0 1))",
387 "MULTILINESTRING((0 1,1 1,0 1))",
388 expected("txi=+")("tix+=")("tii+=")("txx=="));
389 // spike vs spike
390 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
391 "MULTILINESTRING((2 2,1 1,2 2))",
392 expected("tuu++"));
393 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
394 "MULTILINESTRING((2 0,1 1,2 0))",
395 expected("tuu++"));
396 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
397 "MULTILINESTRING((2 1,1 1,2 1))",
398 expected("tuu++"));
399 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
400 "MULTILINESTRING((0 1,1 1,0 1))",
401 expected("tuu++"));
402 // collinear spikes
403 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
404 "MULTILINESTRING((0 0,1 1,0 0))",
405 expected("tii++")("tix+=")("txi=+")("txx==")
406 ("ecc=="));
407 test_geometry<mls, mls>("MULTILINESTRING((0 0,1 1,0 0))",
408 "MULTILINESTRING((1 1,0 0,1 1))",
409 expected("tix+=")("tii+=")("txx==")("txi==")
410 ("txi=+")("tii=+")("txx==")("tix=="));
411 // non-spike similar
412 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
413 "MULTILINESTRING((-1 0,0 0,2 0))",
414 expected("tii++")("mux=="));
415 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
416 "MULTILINESTRING((-1 -1,0 0,2 0))",
417 expected("tii++")("mux=="));
418 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
419 "MULTILINESTRING((2 0,0 0,-1 0))",
420 expected("tiu+=")("mui=+"));
421 test_geometry<mls, mls>("MULTILINESTRING((0 0,10 0))",
422 "MULTILINESTRING((2 0,0 0,-1 -1))",
423 expected("tiu+=")("mui=+"));
424 }
425
426 int test_main(int, char* [])
427 {
428 test_all<float>();
429 test_all<double>();
430
431 #if ! defined(_MSC_VER)
432 test_all<long double>();
433 #endif
434
435 #if defined(HAVE_TTMATH)
436 test_all<ttmath_big>();
437 #endif
438 return 0;
439 }