PageRenderTime 21ms CodeModel.GetById 17ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/doc/src/examples/algorithms/unique.cpp

http://hadesmem.googlecode.com/
C++ | 41 lines | 13 code | 11 blank | 17 comment | 0 complexity | 25b4683e1933030e89f5bc0aac62b746 MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// QuickBook Example
 3
 4// Copyright (c) 2011 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//[unique
11//` Shows how to make a so-called minimal set of a polygon by removing duplicate points
12
13#include <iostream>
14
15#include <boost/geometry.hpp>
16#include <boost/geometry/geometries/polygon.hpp>
17#include <boost/geometry/geometries/adapted/boost_tuple.hpp>
18
19BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
20
21int main()
22{
23    boost::geometry::model::polygon<boost::tuple<double, double> > poly;
24    boost::geometry::read_wkt("POLYGON((0 0,0 0,0 5,5 5,5 5,5 5,5 0,5 0,0 0,0 0,0 0,0 0))", poly);
25    boost::geometry::unique(poly);
26    std::cout << boost::geometry::wkt(poly) << std::endl;
27
28    return 0;
29}
30
31//]
32
33
34//[unique_output
35/*`
36Output:
37[pre
38POLYGON((0 0,0 5,5 5,5 0,0 0))
39]
40*/
41//]