]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/simplify_insert.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 //` Simplify a linestring using a back inserter
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/linestring.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
21 typedef boost::geometry::model::d2::point_xy
<double> P
;
22 typedef boost::geometry::model::linestring
<P
> L
;
25 line
.push_back(P(1.1, 1.1));
26 line
.push_back(P(2.5, 2.1));
27 line
.push_back(P(3.1, 3.1));
28 line
.push_back(P(4.9, 1.1));
29 line
.push_back(P(3.1, 1.9));
32 boost::geometry::simplify_inserter(line
, std::back_inserter(simplified
), 0.5);
35 << " original: " << boost::geometry::dsv(line
) << std::endl
36 << "simplified: " << boost::geometry::dsv(simplified
) << std::endl
;
44 //[simplify_inserter_output
48 original: ((1.1, 1.1), (2.5, 2.1), (3.1, 3.1), (4.9, 1.1), (3.1, 1.9))
49 simplified: ((1.1, 1.1), (3.1, 3.1), (4.9, 1.1), (3.1, 1.9))