/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. #include <algorithms/test_overlaps.hpp>
  8. #include <boost/geometry/geometries/geometries.hpp>
  9. #include <boost/geometry/geometries/point_xy.hpp>
  10. template <typename P>
  11. void test_2d()
  12. {
  13. #if defined(BOOST_GEOMETRY_COMPILE_FAIL)
  14. test_geometry<P, P>("POINT(1 1)", "POINT(1 1)", true);
  15. #endif
  16. test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(0 0,2 2)", true);
  17. // touch -> false
  18. test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(3 3,5 5)", false);
  19. // disjoint -> false
  20. test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 3 3)", "BOX(4 4,6 6)", false);
  21. // within -> false
  22. test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,3 3)", false);
  23. // within+touch -> false
  24. test_geometry<bg::model::box<P>, bg::model::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,5 5)", false);
  25. }
  26. template <typename P>
  27. void test_3d()
  28. {
  29. 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);
  30. 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);
  31. 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);
  32. }
  33. int test_main( int , char* [] )
  34. {
  35. test_2d<bg::model::d2::point_xy<int> >();
  36. test_2d<bg::model::d2::point_xy<double> >();
  37. #if defined(HAVE_TTMATH)
  38. test_2d<bg::model::d2::point_xy<ttmath_big> >();
  39. #endif
  40. //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
  41. return 0;
  42. }