]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/touches/touches_multi.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / touches / touches_multi.cpp
CommitLineData
7c673cae
FG
1// Boost.Geometry (aka GGL, Generic Geometry Library)
2//
3// Copyright (c) 2010-2015 Barend Gehrels, Amsterdam, the Netherlands.
4// Use, modification and distribution is subject to the Boost Software License,
5// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6// http://www.boost.org/LICENSE_1_0.txt)
7
8
9#include "test_touches.hpp"
10
11#include <boost/geometry/algorithms/area.hpp>
12#include <boost/geometry/algorithms/num_geometries.hpp>
13#include <boost/geometry/algorithms/within.hpp>
14
15
16template <typename P>
17void test_all()
18{
19 typedef bg::model::polygon<P> polygon;
20 typedef bg::model::multi_polygon<polygon> mp;
21 typedef bg::model::linestring<P> linestring;
22 typedef bg::model::multi_linestring<linestring> ml;
23
24 test_self_touches<mp>("MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
25 false);
26
27 // Exactly equal
28 test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
29 "MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
30 false);
31
32 // Spatially equal
33 test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 100,100 100,100 0,0 0)))",
34 "MULTIPOLYGON(((0 0,0 100,100 100,100 80,100 20,100 0,0 0)))",
35 false);
36
37 // One exactly equal, another pair touching
38 test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
39 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((30 10,30 20,40 20,40 10,30 10)))",
40 false);
41
42 // One spatially equal (without equal segments), another pair touching
43 test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 5,0 10,5 10,10 10,10 5,10 0,5 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
44 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((30 10,30 20,40 20,40 10,30 10)))",
45 false);
46
47 // Alternate touches
48 test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
49 "MULTIPOLYGON(((10 10,10 20,20 20,20 10,10 10)),((30 10,30 20,40 20,40 10,30 10)))",
50 true);
51
52 // Touch plus inside
53 test_touches<mp, mp>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
54 "MULTIPOLYGON(((10 10,10 20,20 20,20 10,10 10)),((22 2,28 2,28 8,22 8,22 2)))",
55 false);
56
57
58 test_touches<mp, ml>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
59 "MULTILINESTRING((10 10,10 20,20 20,20 10,10 10),(30 10,30 20,40 20,40 10,30 10))",
60 true);
61
62 test_touches<mp, ml>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
63 "MULTILINESTRING((10 10,10 20,20 20,20 10,10 10),(22 2,28 2,28 8,22 8,22 2))",
64 false);
65
66 test_touches<mp, ml>("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)),((20 0,20 10,30 10,30 0,20 0)))",
67 "MULTILINESTRING((10 10,10 20,20 20,20 10,10 10),(50 2,60 2,60 8,50 8,50 2))",
68 true);
69}
70
71int test_main( int , char* [] )
72{
73 test_all<bg::model::d2::point_xy<double> >();
74
75#ifdef HAVE_TTMATH
76 test_all<bg::model::d2::point_xy<ttmath_big> >();
77#endif
78
79 return 0;
80}