]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/adapted/boost_fusion.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 combine Boost.Fusion with Boost.Geometry
15 #include <boost/fusion/include/adapt_struct_named.hpp>
17 #include <boost/geometry.hpp>
18 #include <boost/geometry/geometries/adapted/boost_fusion.hpp>
26 BOOST_FUSION_ADAPT_STRUCT(sample_point
, (double, x
) (double, y
) (double, z
))
27 BOOST_GEOMETRY_REGISTER_BOOST_FUSION_CS(cs::cartesian
)
33 // Set coordinates the Boost.Geometry way (one of the ways)
34 boost::geometry::assign_values(a
, 3, 2, 1);
36 // Set coordinates the Boost.Fusion way
37 boost::fusion::at_c
<0>(b
) = 6;
38 boost::fusion::at_c
<1>(b
) = 5;
39 boost::fusion::at_c
<2>(b
) = 4;
41 // Set coordinates the native way
46 std::cout
<< "Distance a-b: " << boost::geometry::distance(a
, b
) << std::endl
;
47 std::cout
<< "Distance a-c: " << boost::geometry::distance(a
, c
) << std::endl
;
54 //[boost_fusion_output