• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // QuickBook Example
3 
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 
10 //[get_point
11 //` Get the coordinate of a point
12 
13 #include <iostream>
14 
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/point_xy.hpp>
17 
18 namespace bg = boost::geometry;
19 
main()20 int main()
21 {
22     bg::model::d2::point_xy<double> point(1, 2);
23 
24     double x = bg::get<0>(point);
25     double y = bg::get<1>(point);
26 
27     std::cout << "x=" << x << " y=" << y << std::endl;
28 
29     return 0;
30 }
31 
32 //]
33 
34 
35 //[get_point_output
36 /*`
37 Output:
38 [pre
39 x=1 y=2
40 ]
41 */
42 //]
43