1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2
3 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
4
5 // This file was modified by Oracle on 2014, 2015.
6 // Modifications copyright (c) 2014-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_overlaps.hpp"
15
16 template <typename P>
test_box_box_2d()17 void test_box_box_2d()
18 {
19 #if defined(BOOST_GEOMETRY_COMPILE_FAIL)
20 test_geometry<P, P>("POINT(1 1)", "POINT(1 1)", true);
21 #endif
22
23 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(0 0,2 2)", true);
24
25 // touch -> false
26 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(3 3,5 5)", false);
27
28 // disjoint -> false
29 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(4 4,6 6)", false);
30
31 // within -> false
32 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,3 3)", false);
33
34 // within+touch -> false
35 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,5 5)", false);
36 }
37
38 template <typename P>
test_3d()39 void test_3d()
40 {
41 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(0 0 0,2 2 2)", true);
42 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(3 3 3,5 5 5)", false);
43 test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(4 4 4,6 6 6)", false);
44 }
45
46
47 template <typename P>
test_2d()48 void test_2d()
49 {
50 test_box_box_2d<P>();
51 }
52
test_main(int,char * [])53 int test_main( int , char* [] )
54 {
55 test_2d<bg::model::d2::point_xy<int> >();
56 test_2d<bg::model::d2::point_xy<double> >();
57
58 #if defined(HAVE_TTMATH)
59 test_2d<bg::model::d2::point_xy<ttmath_big> >();
60 #endif
61
62 //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
63
64 return 0;
65 }
66