]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/overlay/get_turns_linear_areal.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
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.
8 // This file was modified by Oracle on 2014, 2015.
9 // Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
16 // Use, modification and distribution is subject to the Boost Software License,
17 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
20 #include "test_get_turns.hpp"
21 #include <boost/geometry/geometries/geometries.hpp>
24 //#include <to_svg.hpp>
29 typedef bg::model::point
<T
, 2, bg::cs::cartesian
> pt
;
30 typedef bg::model::linestring
<pt
> ls
;
31 typedef bg::model::polygon
<pt
> poly
;
33 test_geometry
<ls
, poly
>("LINESTRING(15 5,24 5,20 2,19 0,13 -4,1 0,10 0,13 3,15 7,16 10,10 10,8 10,4 6,2 8,1 10)",
34 "POLYGON((0 0,5 5,0 10,20 10,20 2,19 0,0 0)(10 3,15 3,15 7,10 7,10 3))",
35 expected("miu+")("iuu+")("tcc+")("tuu=")("mcu+")("mic=")("muu+")
36 ("tiu+")("mcu+")("mic=")("mcc+")("miu=")("mxu+"));
38 test_geometry
<ls
, poly
>("LINESTRING(5 0,5 5,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
40 test_geometry
<ls
, poly
>("LINESTRING(0 0,5 5,10 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
42 test_geometry
<ls
, poly
>("LINESTRING(0 0,5 0,5 5,10 5,10 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
43 expected("tcu+")("mic=")("mcc+")("txu="));
44 test_geometry
<ls
, poly
>("LINESTRING(10 0,5 0,5 5,10 5,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
45 expected("tcc+")("miu=")("mcu+")("txc="));
47 test_geometry
<ls
, poly
>("LINESTRING(0 0,10 0,10 10)",
48 "POLYGON((0 0,5 5,0 10,20 10,20 2,19 0,0 0)(10 3,15 3,15 7,10 7,10 3))",
49 expected("tcu+")("mic=")("mcu+")("mic=")("mxu+"));
51 test_geometry
<ls
, poly
>("LINESTRING(11 1,10 0,0 0)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
53 test_geometry
<ls
, poly
>("LINESTRING(0 0,10 0,11 1)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
55 test_geometry
<ls
, poly
>("LINESTRING(10 0,0 0,-1 1)", "POLYGON((0 0,0 10,10 10,10 0,0 0))",
59 test_geometry
<ls
, poly
>("LINESTRING(9 1,10 5,9 9)",
60 "POLYGON((0 0,0 10,10 10,10 5,10 0,0 0)(2 2,10 5,2 8,2 2))",
61 expected("tiu+")("tiu+"));
62 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,10 9)",
63 "POLYGON((0 0,0 10,10 10,10 5,10 0,0 0)(2 2,10 5,2 8,2 2))",
64 expected("mcu+")("ecc=")("tiu+")("mxc="));
67 test_geometry
<ls
, poly
>("LINESTRING(9 1,10 5,9 9)",
68 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
69 expected("tuu+")("tiu+"));
70 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,10 9)",
71 "POLYGON((0 0,0 10,10 10,10 5,2 8,2 2,10 5,10 0,0 0))",
72 expected("mcu+")("tuc=")("tcu+")("mxc="));
75 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,2 2)",
76 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
77 expected("mcu+")("mic=")("tcu+")("txc="));
78 test_geometry
<ls
, poly
>("LINESTRING(10 1,10 5,2 8)",
79 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
80 expected("mcu+")("mic=")("tcc+")("txu="));
82 // SPIKE - NON-ENDPOINT - NON-OPPOSITE
85 test_geometry
<ls
, poly
>("LINESTRING(2 2,4 4,1 1)", "POLYGON((0 0,4 4,6 3,6 0,0 0))",
86 expected("mcc+")("txu=")("tcu=")("mxc="));
88 test_geometry
<ls
, poly
>("LINESTRING(0 0,4 4,1 1)", "POLYGON((0 0,4 4,6 3,6 0,0 0))",
89 expected("tcc+")("txu=")("tcu=")("mxc="));
91 test_geometry
<ls
, poly
>("LINESTRING(0 0,3 3,1 1)", "POLYGON((0 0,4 4,6 3,6 0,0 0))",
92 expected("tcc+")("mxu=")("mcu=")("mxc="));
94 test_geometry
<ls
, poly
>("LINESTRING(1 1,3 3,2 2)", "POLYGON((0 0,4 4,6 3,6 0,0 0))",
95 expected("mcc+")("mxu=")("mcu=")("mxc="));
97 test_geometry
<ls
, poly
>("LINESTRING(0 0,3 3,2 2)", "POLYGON((1 1,4 4,6 3,6 0,1 1))",
98 expected("mcc+")("mxu=")("mcu=")("mxc="));
100 test_geometry
<ls
, poly
>("LINESTRING(0 0,4 4,2 2)", "POLYGON((1 1,4 4,6 3,6 0,1 1))",
101 expected("mcc+")("txu=")("tcu=")("mxc="));
102 // spike - out out/eq
103 test_geometry
<ls
, poly
>("LINESTRING(0 0,4 4,2 2)", "POLYGON((1 0,4 4,6 3,1 0))",
105 test_geometry
<ls
, poly
>("LINESTRING(0 0,4 4,2 2)", "POLYGON((0 1,4 4,6 3,6 0,-1 -1,0 1))",
107 // spike - out out/neq
108 test_geometry
<ls
, poly
>("LINESTRING(0 0,4 4,2 2)", "POLYGON((4 0,4 5,6 3,4 0))",
110 test_geometry
<ls
, poly
>("LINESTRING(0 0,4 4,2 2)", "POLYGON((0 4,5 4,6 3,6 0,-1 -1,0 4))",
113 test_geometry
<ls
, poly
>("LINESTRING(0 1,1 1,0 1)", "POLYGON((0 0,3 3,3 0,0 0))",
115 test_geometry
<ls
, poly
>("LINESTRING(0 1,3 3,0 1)", "POLYGON((0 0,3 3,3 0,0 0))",
117 test_geometry
<ls
, poly
>("LINESTRING(0 1,0 0,0 1)", "POLYGON((0 0,3 3,3 0,0 0))",
120 // SPIKE - NON-ENDPOINT - OPPOSITE
123 test_geometry
<ls
, poly
>("LINESTRING(6 6,4 4,0 0,2 2)", "POLYGON((-1 -1,0 0,4 4,6 3,-1 -1))",
124 expected("tcu+")("txc=")("tcc=")("mxu="));
126 test_geometry
<ls
, poly
>("LINESTRING(6 6,4 4,0 0,2 2)", "POLYGON((-1 -1,0 0,5 5,6 3,-1 -1))",
127 expected("mcu+")("txc=")("tcc=")("mxu="));
128 // opposite - eq, neq
129 test_geometry
<ls
, poly
>("LINESTRING(6 6,4 4,0 0,2 2)", "POLYGON((-2 -2,-1 -1,4 4,6 3,-2 -2))",
130 expected("tcu+")("mxc=")("mcc=")("mxu="));
131 // opposite - neq neq
132 test_geometry
<ls
, poly
>("LINESTRING(6 6,4 4,0 0,2 2)", "POLYGON((-2 -2,-1 -1,3 3,6 3,-2 -2))",
133 expected("mcu+")("mxc=")("mcc=")("mxu="));
134 // opposite - neq neq
135 test_geometry
<ls
, poly
>("LINESTRING(6 6,4 4,0 0,2 2)", "POLYGON((-2 -2,-1 -1,3 3,5 5,6 3,-2 -2))",
136 expected("mcu+")("mxc=")("mcc=")("mxu="));
139 test_geometry
<ls
, poly
>("LINESTRING(0 1,1 1,0 1)", // --
140 "POLYGON((1 0,1 1,2 1,1 0))",
142 test_geometry
<ls
, poly
>("LINESTRING(1 2,1 1,1 2)", // |
143 "POLYGON((1 0,1 1,2 1,1 0))",
145 test_geometry
<ls
, poly
>("LINESTRING(0 2,1 1,0 2)",
146 "POLYGON((1 0,1 1,2 1,1 0))",
148 test_geometry
<ls
, poly
>("LINESTRING(2 0,1 1,2 0)",
149 "POLYGON((1 0,1 1,2 1,2 0,1 0))",
150 expected("tiu+")("tiu+")("txu+")); // TODO: should spike point be duplicated?
151 test_geometry
<ls
, poly
>("LINESTRING(0 0,1 1,0 0)", // /
152 "POLYGON((1 0,1 1,2 1,1 0))",
154 test_geometry
<ls
, poly
>("LINESTRING(2 2,1 1,2 2)", // /
155 "POLYGON((1 0,1 1,2 1,1 0))",
158 test_geometry
<ls
, poly
>("LINESTRING(2 1,1 1,2 1)",
159 "POLYGON((1 0,1 1,2 1,1 0))",
160 expected("tcu+")("txc=")("tcc=")("txu="));
163 test_geometry
<ls
, poly
>("LINESTRING(1 3,3 1)",
164 "POLYGON((0 0,0 4,4 4,4 0,2 2,0 0))",
165 expected("mcu+")("mxc="));
167 test_geometry
<ls
, poly
>("LINESTRING(1 7,4 4,7 1)",
168 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
169 expected("tcu+")("mxc="));
170 test_geometry
<ls
, poly
>("LINESTRING(1 7,3 5,7 1)",
171 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
172 expected("mcu+")("mxc="));
173 test_geometry
<ls
, poly
>("LINESTRING(1 7,5 3,7 1)",
174 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
175 expected("mcu+")("mxc="));
176 test_geometry
<ls
, poly
>("LINESTRING(4 4,7 1)",
177 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
178 expected("tcu+")("mxc="));
179 test_geometry
<ls
, poly
>("LINESTRING(5 3,7 1)",
180 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
181 expected("mcu+")("mxc="));
183 test_geometry
<ls
, poly
>("LINESTRING(7 1,4 4,1 7)",
184 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
185 expected("mcc+")("tiu="));
186 test_geometry
<ls
, poly
>("LINESTRING(7 1,3 5,1 7)",
187 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
188 expected("mcc+")("miu="));
189 test_geometry
<ls
, poly
>("LINESTRING(7 1,5 3,1 7)",
190 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
191 expected("mcc+")("ccc=")("miu="));
192 test_geometry
<ls
, poly
>("LINESTRING(7 1,4 4)",
193 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
194 expected("mcc+")("txu="));
195 test_geometry
<ls
, poly
>("LINESTRING(7 1,5 3)",
196 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
197 expected("mcc+")("mxu="));
198 test_geometry
<ls
, poly
>("LINESTRING(7 1,3 5)",
199 "POLYGON((0 0,0 8,8 8,8 0,4 4,0 0))",
200 expected("mcc+")("miu="));
202 // 23.01.2015 - spikes
203 test_geometry
<ls
, poly
>("LINESTRING(3 10, 1 5, 1 10, 3 4, 7 8, 6 10, 10 2)",
204 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
205 expected("miu+")("miu+")("miu+")("mxu+"));
207 test_geometry
<ls
, poly
>("LINESTRING(7 8, 6 10, 11 0)",
208 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
209 expected("miu+")("iuu+"));
212 test_geometry
<ls
, poly
>("LINESTRING(2 3, 4 5, 0 6, 5 6)",
213 "POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4))",
214 expected("miu+")("miu+")("mcu+")("mxc="));
215 test_geometry
<ls
, poly
>("LINESTRING(0 6, 5 6)",
216 "POLYGON((0 0,0 10,10 10,10 0,0 0),(4 4,6 4,6 6,4 6,4 4))",
217 expected("miu+")("mcu+")("mxc="));
221 int test_main(int, char* [])
226 #if ! defined(_MSC_VER)
227 test_all
<long double>();
230 #if defined(HAVE_TTMATH)
231 test_all
<ttmath_big
>();