touches_self.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. //
  3. // Copyright (c) 2012-2015 Barend Gehrels, Amsterdam, the Netherlands.
  4. // This file was modified by Oracle on 2013, 2014. 2015.
  5. // Modifications copyright (c) 2013-2015, Oracle and/or its affiliates.
  6. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
  7. // Use, modification and distribution is subject to the Boost Software License,
  8. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  9. // http://www.boost.org/LICENSE_1_0.txt)
  10. #include "test_touches.hpp"
  11. template <typename P>
  12. void test_all()
  13. {
  14. typedef bg::model::polygon<P> polygon;
  15. // Just a normal polygon
  16. test_self_touches<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
  17. // Self intersecting
  18. test_self_touches<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", false);
  19. // Self touching at a point
  20. test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2,3 2,3 0,0 0))", true);
  21. // Self touching at a segment
  22. test_self_touches<polygon>("POLYGON((0 0,0 3,2 3,2 2,1 2,1 1,2 1,2 2.5,3 2.5,3 0,0 0))", true);
  23. }
  24. int test_main( int , char* [] )
  25. {
  26. test_all<bg::model::d2::point_xy<double> >();
  27. #if defined(HAVE_TTMATH)
  28. test_all<bg::model::d2::point_xy<ttmath_big> >();
  29. #endif
  30. return 0;
  31. }