]>
Commit | Line | Data |
---|---|---|
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 | //[assign_box_corners | |
11 | //` Shows how four point can be assigned from a 2D box | |
12 | ||
13 | #include <iostream> | |
14 | ||
15 | #include <boost/geometry.hpp> | |
16 | #include <boost/geometry/geometries/box.hpp> | |
17 | #include <boost/geometry/geometries/point_xy.hpp> | |
18 | ||
19 | using namespace boost::geometry; | |
20 | ||
21 | int main() | |
22 | { | |
23 | typedef model::d2::point_xy<double> point; | |
24 | typedef model::box<point> box; | |
25 | ||
26 | box b; | |
27 | assign_values(b, 2, 2, 5, 5); | |
28 | ||
29 | point ll, lr, ul, ur; | |
30 | assign_box_corners(b, ll, lr, ul, ur); | |
31 | ||
32 | std::cout << "box: " << dsv(b) << std::endl << std::endl; | |
33 | ||
34 | std::cout << dsv(ul) << " --- " << dsv(ur) << std::endl; | |
35 | for (int i = 0; i < 3; i++) | |
36 | { | |
37 | std::cout << " | |" << std::endl; | |
38 | } | |
39 | std::cout << dsv(ll) << " --- " << dsv(lr) << std::endl; | |
40 | ||
41 | return 0; | |
42 | } | |
43 | ||
44 | //] | |
45 | ||
46 | ||
47 | //[assign_box_corners_output | |
48 | /*` | |
49 | Output: | |
50 | [pre | |
51 | box: ((2, 2), (5, 5)) | |
52 | ||
53 | (2, 5) --- (5, 5) | |
54 | | | | |
55 | | | | |
56 | | | | |
57 | (2, 2) --- (5, 2) | |
58 | ] | |
59 | */ | |
60 | //] |