polygon_90_data_test.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. // Boost.Polygon library polygon_90_data_test.cpp file
  2. // Copyright Andrii Sydorchuk 2015.
  3. // Distributed under the Boost Software License, Version 1.0.
  4. // (See accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. // See http://www.boost.org for updates, documentation, and revision history.
  7. #include <boost/core/lightweight_test.hpp>
  8. #include <boost/polygon/polygon.hpp>
  9. #include <iostream>
  10. #include <vector>
  11. using namespace boost::polygon;
  12. void polygon_90_data_test()
  13. {
  14. typedef polygon_90_data<int> polygon_type;
  15. typedef polygon_traits_90<polygon_type>::point_type point_type;
  16. typedef polygon_type::iterator_type iterator_type;
  17. std::vector<point_type> data;
  18. data.push_back(point_type(0, 0)); // 1
  19. data.push_back(point_type(10, 0)); // 2
  20. data.push_back(point_type(10, 10)); // 3
  21. data.push_back(point_type(0, 10)); // 4
  22. polygon_type polygon;
  23. polygon.set(data.begin(), data.end());
  24. std::cout << "Interesting: " << std::endl;
  25. for (polygon_type::compact_iterator_type it = polygon.begin_compact(); it != polygon.end_compact(); ++it) {
  26. std::cout << *it << " ";
  27. }
  28. std::cout << std::endl;
  29. iterator_type it = polygon.begin();
  30. for (int i = 0; i < 2; i++) {
  31. it++;
  32. }
  33. iterator_type it_3rd = it;
  34. it++;
  35. BOOST_TEST(it != it_3rd);
  36. }
  37. int main()
  38. {
  39. polygon_90_data_test();
  40. return boost::report_errors();
  41. }