]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/point.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::point, modelling the Point Concept
14 #include <boost/geometry.hpp>
16 namespace bg
= boost::geometry
;
20 bg::model::point
<double, 2, bg::cs::cartesian
> point1
;
21 bg::model::point
<double, 3, bg::cs::cartesian
> point2(1.0, 2.0, 3.0); /*< Construct, assigning three coordinates >*/
23 bg::set
<0>(point1
, 1.0); /*< Set a coordinate, generic. >*/
24 point1
.set
<1>(2.0); /*< Set a coordinate, class-specific ([*Note]: prefer `bg::set()`). >*/
26 double x
= bg::get
<0>(point1
); /*< Get a coordinate, generic. >*/
27 double y
= point1
.get
<1>(); /*< Get a coordinate, class-specific ([*Note]: prefer `bg::get()`). >*/
29 std::cout
<< x
<< ", " << y
<< std::endl
;