overlaps_box.cpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
  3. // This file was modified by Oracle on 2014, 2015.
  4. // Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
  5. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  6. // Use, modification and distribution is subject to the Boost Software License,
  7. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  8. // http://www.boost.org/LICENSE_1_0.txt)
  9. #include "test_overlaps.hpp"
  10. template <typename P>
  11. void test_box_box_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. template <typename P>
  34. void test_2d()
  35. {
  36. test_box_box_2d<P>();
  37. }
  38. int test_main( int , char* [] )
  39. {
  40. test_2d<bg::model::d2::point_xy<int> >();
  41. test_2d<bg::model::d2::point_xy<double> >();
  42. #if defined(HAVE_TTMATH)
  43. test_2d<bg::model::d2::point_xy<ttmath_big> >();
  44. #endif
  45. //test_3d<bg::model::point<double, 3, bg::cs::cartesian> >();
  46. return 0;
  47. }