/Src/Dependencies/Boost/libs/geometry/doc/src/examples/algorithms/assign_point_to_index.cpp

http://hadesmem.googlecode.com/ · C++ · 46 lines · 16 code · 13 blank · 17 comment · 0 complexity · 1958d9060c231c8b60b4c0205deee106 MD5 · raw file

  1. // Boost.Geometry (aka GGL, Generic Geometry Library)
  2. // QuickBook Example
  3. // Copyright (c) 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. //[assign_point_to_index
  8. //` Shows how to assign the lower-left or upper-right point from a box
  9. #include <iostream>
  10. #include <boost/geometry.hpp>
  11. #include <boost/geometry/geometries/box.hpp>
  12. #include <boost/geometry/geometries/point_xy.hpp>
  13. using namespace boost::geometry;
  14. int main()
  15. {
  16. typedef model::d2::point_xy<int> point;
  17. typedef model::box<point> box;
  18. point lower_left(0, 0), upper_right(2, 2);
  19. box b;
  20. assign_point_to_index<0>(lower_left, b);
  21. assign_point_to_index<1>(upper_right, b);
  22. std::cout << "box: " << dsv(b) << std::endl;
  23. return 0;
  24. }
  25. //]
  26. //[assign_point_to_index_output
  27. /*`
  28. Output:
  29. [pre
  30. box: ((0, 0), (2, 2))
  31. ]
  32. */
  33. //]