]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | // QuickBook Example | |
3 | ||
4 | // Copyright (c) 2011-2012 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 | //[return_envelope | |
11 | //` Shows how to return the envelope of a ring | |
12 | ||
13 | #include <iostream> | |
14 | ||
15 | ||
16 | #include <boost/geometry.hpp> | |
17 | #include <boost/geometry/geometries/box.hpp> | |
18 | #include <boost/geometry/geometries/point_xy.hpp> | |
19 | #include <boost/geometry/geometries/ring.hpp> | |
20 | ||
21 | #include <boost/assign.hpp> | |
22 | ||
23 | /*<-*/ #include "create_svg_two.hpp" /*->*/ | |
24 | ||
25 | int main() | |
26 | { | |
27 | using namespace boost::assign; | |
28 | ||
29 | typedef boost::geometry::model::d2::point_xy<double> point; | |
30 | ||
31 | boost::geometry::model::ring<point> ring; | |
32 | ring += | |
33 | point(4.0, -0.5), point(3.5, 1.0), | |
34 | point(2.0, 1.5), point(3.5, 2.0), | |
35 | point(4.0, 3.5), point(4.5, 2.0), | |
36 | point(6.0, 1.5), point(4.5, 1.0), | |
37 | point(4.0, -0.5); | |
38 | ||
39 | typedef boost::geometry::model::box<point> box; | |
40 | ||
41 | std::cout | |
42 | << "return_envelope:" | |
43 | << boost::geometry::dsv(boost::geometry::return_envelope<box>(ring)) | |
44 | << std::endl; | |
45 | ||
46 | /*<-*/ create_svg("return_envelope.svg", ring, boost::geometry::return_envelope<box>(ring)); /*->*/ | |
47 | return 0; | |
48 | } | |
49 | ||
50 | //] | |
51 | ||
52 | ||
53 | //[return_envelope_output | |
54 | /*` | |
55 | Output: | |
56 | [pre | |
57 | return_envelope:((2, -0.5), (6, 3.5)) | |
58 | ||
59 | [$img/algorithms/return_envelope.png] | |
60 | ] | |
61 | */ | |
62 | //] | |
63 |