]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/adapted/boost_array.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 //` Shows how to use a Boost.Array using Boost.Geometry's distance, set and assign_values algorithms
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/linestring.hpp>
17 #include <boost/geometry/geometries/adapted/boost_array.hpp>
19 BOOST_GEOMETRY_REGISTER_BOOST_ARRAY_CS(cs::cartesian
)
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
;
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
;
31 boost::geometry::assign_values(b
, 2.2, 3.3);
32 std::cout
<< boost::geometry::distance(a
, b
) << std::endl
;
34 boost::geometry::model::linestring
<boost::array
<double, 2> > line
;