]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/point.cpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / point.cpp
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 //[point
11 //` Declaration and use of the Boost.Geometry model::point, modelling the Point Concept
12
13 #include <iostream>
14 #include <boost/geometry.hpp>
15
16 namespace bg = boost::geometry;
17
18 int main()
19 {
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 >*/
22
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()`). >*/
25
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()`). >*/
28
29 std::cout << x << ", " << y << std::endl;
30 return 0;
31 }
32
33 //]
34
35
36 //[point_output
37 /*`
38 Output:
39 [pre
40 1, 2
41 ]
42 */
43 //]