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

http://hadesmem.googlecode.com/ · C++ · 42 lines · 12 code · 13 blank · 17 comment · 0 complexity · eafab710cf0b07e94e08485bf2663920 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. //[get_point
  8. //` Get the coordinate of a point
  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::d2::point_xy<double> point(1, 2);
  16. double x = bg::get<0>(point);
  17. double y = bg::get<1>(point);
  18. std::cout << "x=" << x << " y=" << y << std::endl;
  19. return 0;
  20. }
  21. //]
  22. //[get_point_output
  23. /*`
  24. Output:
  25. [pre
  26. x=1 y=2
  27. ]
  28. */
  29. //]