]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/adapted/boost_range/strided.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / adapted / boost_range / strided.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 //[boost_range_strided
11 //` Shows how to use a Boost.Geometry ring, strided by Boost.Range adaptor
12
13 #include <iostream>
14
15 #include <boost/assign.hpp>
16
17 #include <boost/geometry.hpp>
18 #include <boost/geometry/geometries/point_xy.hpp>
19 #include <boost/geometry/geometries/ring.hpp>
20 #include <boost/geometry/geometries/adapted/boost_range/strided.hpp>
21
22
23 int main()
24 {
25 using namespace boost::assign;
26 using boost::adaptors::strided;
27
28 typedef boost::geometry::model::d2::point_xy<int> xy;
29 boost::geometry::model::ring<xy> ring;
30 ring += xy(0, 0);
31 ring += xy(0, 1);
32 ring += xy(0, 2);
33 ring += xy(1, 2);
34 ring += xy(2, 2);
35 ring += xy(2, 0);
36
37 boost::geometry::correct(ring);
38
39 std::cout
40 << "Normal : " << boost::geometry::dsv(ring) << std::endl
41 << "Strided: " << boost::geometry::dsv(ring | strided(2)) << std::endl;
42
43 return 0;
44 }
45
46 //]
47
48 //[boost_range_strided_output
49 /*`
50 Output:
51 [pre
52 Normal : ((0, 0), (0, 1), (0, 2), (1, 2), (2, 2), (2, 0), (0, 0))
53 Strided: ((0, 0), (0, 2), (2, 2), (0, 0))
54 ]
55 */
56 //]