]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/geometries/adapted/boost_array.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / geometries / adapted / boost_array.cpp
CommitLineData
7c673cae
FG
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_array
11//` Shows how to use a Boost.Array using Boost.Geometry's distance, set and assign_values algorithms
12
13#include <iostream>
14
15#include <boost/geometry.hpp>
16#include <boost/geometry/geometries/linestring.hpp>
17#include <boost/geometry/geometries/adapted/boost_array.hpp>
18
19BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian)
20
21int main()
22{
23 boost::array<float, 2> a = { {1, 2} };
24 boost::array<double, 2> b = { {2, 3} };
25 std::cout << boost::geometry::distance(a, b) << std::endl;
26
27 boost::geometry::set<0>(a, 1.1f);
28 boost::geometry::set<1>(a, 2.2f);
29 std::cout << boost::geometry::distance(a, b) << std::endl;
30
31 boost::geometry::assign_values(b, 2.2, 3.3);
32 std::cout << boost::geometry::distance(a, b) << std::endl;
33
34 boost::geometry::model::linestring<boost::array<double, 2> > line;
35 line.push_back(b);
36
37 return 0;
38}
39
40//]
41
42//[boost_array_output
43/*`
44Output:
45[pre
461.41421
471.20416
481.55563
49]
50*/
51//]