]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/assign_box_corners.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / algorithms / assign_box_corners.cpp
CommitLineData
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//[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
19using namespace boost::geometry;
20
21int 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/*`
49Output:
50[pre
51box: ((2, 2), (5, 5))
52
53(2, 5) --- (5, 5)
54 | |
55 | |
56 | |
57(2, 2) --- (5, 2)
58]
59*/
60//]