PageRenderTime 45ms CodeModel.GetById 32ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/algorithms/overlaps.cpp

http://hadesmem.googlecode.com/
C++ | 59 lines | 31 code | 17 blank | 11 comment | 0 complexity | 3dfbf377749dedeabd7637b0a7b100ad MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2//
 3// Copyright (c) 2007-2011 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
15template <typename P>
16void 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
37template <typename P>
38void 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
47int 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}