]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/geometries/adapted/boost_tuple.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)
12 Shows how to use Boost.Tuple points in Boost.Geometry
14 Working with Boost.Tuples in Boost.Geometry is straightforward and shown in
15 various other examples as well.
21 #include <boost/geometry.hpp>
22 #include <boost/geometry/geometries/polygon.hpp>
23 #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
25 BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian
)
29 boost::geometry::model::polygon
<boost::tuple
<double, double> > poly
;
30 poly
.outer().push_back(boost::make_tuple(1.0, 2.0));
31 poly
.outer().push_back(boost::make_tuple(6.0, 4.0));
32 poly
.outer().push_back(boost::make_tuple(5.0, 1.0));
33 poly
.outer().push_back(boost::make_tuple(1.0, 2.0));
35 std::cout
<< "Area: " << boost::geometry::area(poly
) << std::endl
;
36 std::cout
<< "Contains (1.5, 2.5): "
38 << boost::geometry::within(boost::make_tuple(1.5, 2.5), poly
)
51 Contains (1.5, 2.5): false