6226ddd04ee1cd57aca8e5e7582bd3b6cfe0e8a6
[platform/upstream/boost.git] / libs / geometry / test / algorithms / overlaps.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 //
3 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
4 // Use, modification and distribution is subject to the Boost Software License,
5 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt)
7
8 #include <algorithms/test_overlaps.hpp>
9
10
11 #include <boost/geometry/geometries/geometries.hpp>
12 #include <boost/geometry/geometries/point_xy.hpp>
13
14
15 template <typename P>
16 void test_2d()
17 {
18 #if defined(BOOST_GEOMETRY_COMPILE_FAIL)
19     test_geometry<P, P>("POINT(1 1)", "POINT(1 1)", true);
20 #endif
21
22     test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(0 0,2 2)", true);
23
24     // touch -> false
25     test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(3 3,5 5)", false);
26
27     // disjoint -> false
28     test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(4 4,6 6)", false);
29
30     // within -> false
31     test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,3 3)", false);
32
33     // within+touch -> false
34     test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,5 5)", false);
35 }
36
37 template <typename P>
38 void test_3d()
39 {
40     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);
41     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);
42     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);
43 }
44
45
46
47 int test_main( int , char* [] )
48 {
49     test_2d<bg::model::d2::point_xy<int> >();
50     test_2d<bg::model::d2::point_xy<double> >();
51
52 #if defined(HAVE_TTMATH)
53     test_2d<bg::model::d2::point_xy<ttmath_big> >();
54 #endif
55
56    //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
57
58     return 0;
59 }