]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/point_xy.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
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)
11 //` Declaration and use of the Boost.Geometry model::d2::point_xy, modelling the Point Concept
14 #include <boost/geometry.hpp>
15 #include <boost/geometry/geometries/point_xy.hpp>
17 namespace bg
= boost::geometry
;
21 bg::model::d2::point_xy
<double> point1
;
22 bg::model::d2::point_xy
<double> point2(1.0, 2.0); /*< Construct, assigning coordinates. >*/
24 bg::set
<0>(point1
, 1.0); /*< Set a coordinate, generic. >*/
25 point1
.y(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/
27 double x
= bg::get
<0>(point1
); /*< Get a coordinate, generic. >*/
28 double y
= point1
.y(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/
30 std::cout
<< x
<< ", " << y
<< std::endl
;