]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/crosses/crosses_sph.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / crosses / crosses_sph.cpp
1 // Boost.Geometry
2
3 // Copyright (c) 2016 Oracle and/or its affiliates.
4 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
5
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9
10 #include "test_crosses.hpp"
11
12 #include <algorithms/overlay/overlay_cases.hpp>
13 #include <algorithms/overlay/multi_overlay_cases.hpp>
14
15 #include <boost/geometry/geometries/geometries.hpp>
16
17
18 template <typename P>
19 void test_linestring_polygon()
20 {
21 typedef bg::model::linestring<P> ls;
22 typedef bg::model::polygon<P> poly;
23 typedef bg::model::polygon<P> ring;
24
25 test_geometry<ls, poly>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
26 test_geometry<ls, ring>("LINESTRING(11 0,11 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
27 test_geometry<ls, poly>("LINESTRING(0 0,10 10)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
28 test_geometry<ls, poly>("LINESTRING(5 0,5 5,10 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
29 test_geometry<ls, poly>("LINESTRING(5 1,5 5,9 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
30 test_geometry<ls, poly>("LINESTRING(11 1,11 5)", "POLYGON((0 0,0 10,10 10,10 0,0 0))", false);
31
32 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9)",
33 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
34 false);
35
36 test_geometry<ls, poly>("LINESTRING(9 1,10 5,9 9,1 9,1 1,9 1)",
37 "POLYGON((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5))",
38 false);
39
40 test_geometry<ls, poly>("LINESTRING(0 0,10 0,10 10,0 10,0 0)",
41 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
42 false);
43 }
44
45 template <typename P>
46 void test_linestring_multi_polygon()
47 {
48 typedef bg::model::linestring<P> ls;
49 typedef bg::model::polygon<P> poly;
50 typedef bg::model::multi_polygon<poly> mpoly;
51
52 test_geometry<ls, mpoly>("LINESTRING(10 1,10 5,10 9)",
53 "MULTIPOLYGON(((0 20,0 30,10 30,10 20,0 20)),((0 0,0 10,10 10,10 0,0 0),(10 5,2 8,2 2,10 5)))",
54 false);
55 }
56
57 template <typename P>
58 void test_multi_linestring_polygon()
59 {
60 typedef bg::model::linestring<P> ls;
61 typedef bg::model::polygon<P> poly;
62 typedef bg::model::ring<P> ring;
63 typedef bg::model::multi_linestring<ls> mls;
64
65 test_geometry<mls, poly>("MULTILINESTRING((11 11, 20 20),(5 7, 4 1))",
66 "POLYGON((0 0,0 10,10 10,10 0,0 0),(2 2,4 2,4 4,2 4,2 2))",
67 true);
68
69 test_geometry<mls, ring>("MULTILINESTRING((6 6,15 15),(0 0, 7 7))",
70 "POLYGON((5 5,5 15,15 15,15 5,5 5))",
71 true);
72
73 test_geometry<mls, poly>("MULTILINESTRING((3 10.031432746397092, 1 5, 1 10.013467818052765, 3 4, 7 8, 6 10.035925377760330, 10 2))",
74 "POLYGON((0 0,0 10,10 10,10 0,0 0))",
75 false);
76 }
77
78 template <typename P>
79 void test_multi_linestring_multi_polygon()
80 {
81 typedef bg::model::linestring<P> ls;
82 typedef bg::model::polygon<P> poly;
83 typedef bg::model::multi_linestring<ls> mls;
84 typedef bg::model::multi_polygon<poly> mpoly;
85
86 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,10 0,10 10,0 10,0 0),(2 2,5 5,2 8,2 2))",
87 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0),(2 2,5 5,2 8,2 2)))",
88 false);
89
90 test_geometry<mls, mpoly>("MULTILINESTRING((0 0,10 0,10 10),(10 10,0 10,0 0),(20 20,50 50,20 80,20 20))",
91 "MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))",
92 false);
93
94 test_geometry<mls, mpoly>("MULTILINESTRING((5 -2,4 -2,5 0),(5 -2,6 -2,5 0))",
95 "MULTIPOLYGON(((5 0,0 5,10 5,5 0)),((5 0,10 -5,0 -5,5 0)))",
96 false);
97 }
98
99
100 template <typename P>
101 void test_all()
102 {
103 test_linestring_polygon<P>();
104 test_linestring_multi_polygon<P>();
105 test_multi_linestring_polygon<P>();
106 test_multi_linestring_multi_polygon<P>();
107 }
108
109
110 int test_main( int , char* [] )
111 {
112 test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
113
114 #if defined(HAVE_TTMATH)
115 test_cs<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
116 #endif
117
118 return 0;
119 }