]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/touches/touches_box.cpp
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / touches / touches_box.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 //
3 // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2013, 2014, 2015.
6 // Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
7
8 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
9
10 // Use, modification and distribution is subject to the Boost Software License,
11 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
12 // http://www.boost.org/LICENSE_1_0.txt)
13
14 #include "test_touches.hpp"
15
16 template <typename P>
17 void test_all()
18 {
19 typedef bg::model::box<P> box;
20
21 test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((5 1,5 2,6 2,6 1,5 1))", true);
22 test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((4 1,4 2,5 2,5 1,4 1))", false);
23 test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((4 1,4 2,6 2,6 1,4 1))", false);
24
25 // Point-size
26 test_touches<box, box>("POLYGON((0 0,0 5,5 5,5 0,0 0))", "POLYGON((5 5,5 5,5 5,5 5,5 5))", true);
27 // TODO: should it be TRUE?
28 test_touches<box, box>("POLYGON((5 5,5 5,5 5,5 5,5 5))", "POLYGON((5 5,5 5,5 5,5 5,5 5))", true);
29 }
30
31 template <typename P>
32 void test_box_3d()
33 {
34 typedef bg::model::box<P> box;
35
36 check_touches<box, box>(box(P(0,0,0),P(5,5,5)), box(P(5,1,2),P(6,6,6)),
37 "box(P(0,0,0),P(5,5,5))", "box(P(5,1,2),P(6,6,6))",
38 true);
39
40 check_touches<box, box>(box(P(0,0,0),P(5,5,5)), box(P(5,5,5),P(6,6,6)),
41 "box(P(0,0,0),P(5,5,5))", "box(P(5,5,5),P(6,6,6))",
42 true);
43 }
44
45
46 int test_main( int , char* [] )
47 {
48 test_all<bg::model::d2::point_xy<double> >();
49 test_box_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
50
51 #if defined(HAVE_TTMATH)
52 test_all<bg::model::d2::point_xy<ttmath_big> >();
53 #endif
54
55 return 0;
56 }
57
58 /*
59 with viewy as
60 (
61 select geometry::STGeomFromText('POLYGON((0 0,0 100,100 100,100 0,0 0))',0) as p
62 , geometry::STGeomFromText('POLYGON((200 0,100 50,200 100,200 0))',0) as q
63 )
64 -- select p from viewy union all select q from viewy
65 select p.STTouches(q) from viewy
66 */