/Src/Dependencies/Boost/libs/geometry/doc/src/examples/core/set_box.cpp

http://hadesmem.googlecode.com/ · C++ · 44 lines · 14 code · 13 blank · 17 comment · 0 complexity · 3e0c6d598958da5cbe68dc038796f3c7 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. //[set_box
  8. //` Set the coordinate of a box
  9. #include <iostream>
  10. #include <boost/geometry.hpp>
  11. #include <boost/geometry/geometries/point_xy.hpp>
  12. namespace bg = boost::geometry;
  13. int main()
  14. {
  15. bg::model::box<bg::model::d2::point_xy<double> > box;
  16. bg::set<bg::min_corner, 0>(box, 0);
  17. bg::set<bg::min_corner, 1>(box, 2);
  18. bg::set<bg::max_corner, 0>(box, 4);
  19. bg::set<bg::max_corner, 1>(box, 5);
  20. std::cout << "Extent: " << bg::dsv(box) << std::endl;
  21. return 0;
  22. }
  23. //]
  24. //[set_box_output
  25. /*`
  26. Output:
  27. [pre
  28. Extent: ((0, 2), (4, 5))
  29. ]
  30. */
  31. //]