]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/multi_point.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / multi_point.cpp
1 // Boost.Geometry
2 // QuickBook Example
3
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland.
6
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10
11 //[multi_point
12 //` Declaration and use of the Boost.Geometry model::multi_point, modelling the MultiPoint Concept
13
14 #include <iostream>
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/geometries.hpp>
17
18 namespace bg = boost::geometry;
19
20 int main()
21 {
22 typedef bg::model::point<double, 2, bg::cs::cartesian> point_t;
23 typedef bg::model::multi_point<point_t> mpoint_t;
24
25 mpoint_t mpt1; /*< Default-construct a multi_point. >*/
26
27 #if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) \
28 && !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
29
30 mpoint_t mpt2{{{0.0, 0.0}, {1.0, 1.0}, {2.0, 2.0}}}; /*< Construct a multi_point containing three points, using C++11 unified initialization syntax. >*/
31
32 #endif
33
34 bg::append(mpt1, point_t(0.0, 0.0)); /*< Append point to the multi_point. >*/
35 bg::append(mpt1, point_t(1.0, 1.0));
36 bg::append(mpt1, point_t(2.0, 2.0));
37
38 std::size_t count = bg::num_points(mpt1);
39
40 std::cout << count << std::endl;
41
42 return 0;
43 }
44
45 //]
46
47
48 //[multi_point_output
49 /*`
50 Output:
51 [pre
52 3
53 ]
54 */
55 //]