]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/test/algorithms/touches/touches_box.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / touches / touches_box.cpp
CommitLineData
7c673cae
FG
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
16template <typename P>
17void 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
31template <typename P>
32void 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
46int 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
7c673cae
FG
51 return 0;
52}
53
54/*
55with viewy as
56(
57select geometry::STGeomFromText('POLYGON((0 0,0 100,100 100,100 0,0 0))',0) as p
58 , geometry::STGeomFromText('POLYGON((200 0,100 50,200 100,200 0))',0) as q
59)
60-- select p from viewy union all select q from viewy
61select p.STTouches(q) from viewy
62*/