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

http://hadesmem.googlecode.com/ · C++ · 61 lines · 31 code · 15 blank · 15 comment · 0 complexity · 64a97c873b990b81e671195bba35e26f MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // Unit Test
  3. // Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
  4. // Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
  5. // Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
  6. // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
  7. // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
  8. // Use, modification and distribution is subject to the Boost Software License,
  9. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  10. // http://www.boost.org/LICENSE_1_0.txt)
  11. #include <cstddef>
  12. #include <string>
  13. #include <algorithms/test_convex_hull.hpp>
  14. #include <boost/geometry/geometries/geometries.hpp>
  15. #include <boost/geometry/geometries/point_xy.hpp>
  16. template <typename P>
  17. void test_all()
  18. {
  19. // from sample linestring
  20. test_geometry<bg::model::linestring<P> >(
  21. "linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", 5, 4, 3.8);
  22. // rectangular, with concavity
  23. test_geometry<bg::model::polygon<P> >(
  24. "polygon((1 1, 1 4, 3 4, 3 3, 4 3, 4 4, 5 4, 5 1, 1 1))",
  25. 9, 5, 12.0);
  26. // from sample polygon, with concavity
  27. test_geometry<bg::model::polygon<P> >(
  28. "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
  29. ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
  30. 12, 8, 5.245);
  31. test_geometry<bg::model::ring<P> >(
  32. "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
  33. ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
  34. 12, 8, 5.245);
  35. // Waits for next cycle test_geometry<bg::model::box<P> >("box(0 0,2 2)", 5, 5, 4);
  36. }
  37. int test_main(int, char* [])
  38. {
  39. //test_all<bg::model::d2::point_xy<int> >();
  40. test_all<bg::model::d2::point_xy<float> >();
  41. test_all<bg::model::d2::point_xy<double> >();
  42. #if defined(HAVE_TTMATH)
  43. test_all<bg::model::d2::point_xy<ttmath_big> >();
  44. #endif
  45. return 0;
  46. }