]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/crosses/crosses.cpp
21ed78d1264fac57f49a43352c67d541ded14aa7
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // This file was modified by Oracle on 2014, 2017.
6 // Modifications copyright (c) 2014-2017 Oracle and/or its affiliates.
8 // Use, modification and distribution is subject to the Boost Software License,
9 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
12 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
14 #include "test_crosses.hpp"
19 typedef bg::model::multi_point
<P
> mpt
;
20 typedef bg::model::linestring
<P
> ls
;
21 typedef bg::model::multi_linestring
<ls
> mls
;
23 test_geometry
<mpt
, ls
>("MULTIPOINT(1 0,1 1)", "LINESTRING(0 0,1 0,3 3)", true);
24 test_geometry
<mpt
, ls
>("MULTIPOINT(0 0,1 1)", "LINESTRING(0 0,1 0,3 3)", false);
25 test_geometry
<mpt
, ls
>("MULTIPOINT(0 0,1 1)", "LINESTRING(0 0,1 1,3 3)", false);
27 test_geometry
<mpt
, mls
>("MULTIPOINT(0 0,3 0)", "MULTILINESTRING((0 0,0 1,1 1),(1 1,1 0,0 0))", true);
28 test_geometry
<mpt
, mls
>("MULTIPOINT(0 0,1 1)", "MULTILINESTRING((0 0,0 1,1 1),(1 1,1 0,0 0))", false);
34 typedef bg::model::multi_point
<P
> mpt
;
35 typedef bg::model::polygon
<P
> poly
;
36 typedef bg::model::multi_polygon
<poly
> mpoly
;
38 test_geometry
<mpt
, poly
>("MULTIPOINT(1 1,6 6)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
39 test_geometry
<mpt
, poly
>("MULTIPOINT(0 0,6 6)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
40 test_geometry
<mpt
, poly
>("MULTIPOINT(0 0,1 1)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
42 test_geometry
<mpt
, mpoly
>("MULTIPOINT(0 0,1 1)", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 9,9 9,9 5,5 5)))", false);
43 test_geometry
<mpt
, mpoly
>("MULTIPOINT(1 1,1 6)", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)),((5 5,5 9,9 9,9 5,5 5)))", true);
49 typedef bg::model::linestring
<P
> ls
;
50 typedef bg::model::multi_linestring
<ls
> mls
;
52 test_geometry
<ls
, ls
>("LINESTRING(0 0,2 2,4 4)", "LINESTRING(0 1,2 1,3 1)", true);
53 test_geometry
<ls
, ls
>("LINESTRING(0 0,2 2)", "LINESTRING(0 1,2 1)", true);
54 test_geometry
<ls
, ls
>("LINESTRING(0 0,2 2,4 4)", "LINESTRING(0 1,1 1,2 2,3 2)", false);
56 test_geometry
<ls
, mls
>("LINESTRING(0 0,2 2,4 4)", "MULTILINESTRING((0 1,4 1),(0 2,4 2))", true);
57 test_geometry
<mls
, ls
>("MULTILINESTRING((0 1,4 1),(0 2,4 2))", "LINESTRING(0 0,2 2,4 4)", true);
59 test_geometry
<mls
, mls
>("MULTILINESTRING((0 0,2 2,4 4),(3 0,3 4))", "MULTILINESTRING((0 1,4 1),(0 2,4 2))", true);
61 // spike - boundary and interior on the same point
62 test_geometry
<ls
, ls
>("LINESTRING(3 7, 8 8, 2 6)", "LINESTRING(5 7, 10 7, 0 7)", true);
68 typedef bg::model::linestring
<P
> ls
;
69 typedef bg::model::multi_linestring
<ls
> mls
;
70 typedef bg::model::ring
<P
> ring
;
71 typedef bg::model::polygon
<P
> poly
;
72 typedef bg::model::multi_polygon
<poly
> mpoly
;
74 test_geometry
<ls
, ring
>("LINESTRING(0 0, 10 10)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
75 test_geometry
<ls
, poly
>("LINESTRING(0 0, 10 10)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
76 test_geometry
<ls
, mpoly
>("LINESTRING(0 0, 10 10)", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))", true);
78 test_geometry
<ls
, poly
>("LINESTRING(0 0, 10 0)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
79 test_geometry
<ls
, poly
>("LINESTRING(1 1, 5 5)", "POLYGON((0 0,0 5,5 5,5 0,0 0))", false);
81 test_geometry
<mls
, ring
>("MULTILINESTRING((1 1, 5 5),(6 6,7 7))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
82 test_geometry
<mls
, poly
>("MULTILINESTRING((1 1, 5 5),(6 6,7 7))", "POLYGON((0 0,0 5,5 5,5 0,0 0))", true);
83 test_geometry
<mls
, mpoly
>("MULTILINESTRING((1 1, 5 5),(6 6,7 7))", "MULTIPOLYGON(((0 0,0 5,5 5,5 0,0 0)))", true);
95 int test_main( int , char* [] )
97 test_2d
<bg::model::d2::point_xy
<int> >();
98 test_2d
<bg::model::d2::point_xy
<double> >();
100 #if defined(HAVE_TTMATH)
101 test_2d
<bg::model::d2::point_xy
<ttmath_big
> >();
104 //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();