• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 //[expand
11 //` Shows the usage of expand
12 
13 #include <iostream>
14 #include <list>
15 
16 #include <boost/geometry.hpp>
17 #include <boost/geometry/geometries/box.hpp>
18 #include <boost/geometry/geometries/point_xy.hpp>
19 
main()20 int main()
21 {
22     typedef boost::geometry::model::d2::point_xy<short int> point_type;
23     typedef boost::geometry::model::box<point_type> box_type;
24 
25     using boost::geometry::expand;
26 
27     box_type box = boost::geometry::make_inverse<box_type>(); /*< expand is usually preceded by a call to assign_inverse or make_inverse  >*/
28 
29     expand(box, point_type(0, 0));
30     expand(box, point_type(1, 2));
31     expand(box, point_type(5, 4));
32     expand(box, boost::geometry::make<box_type>(3, 3, 5, 5));
33 
34     std::cout << boost::geometry::dsv(box) << std::endl;
35 
36     return 0;
37 }
38 
39 //]
40 
41 //[expand_output
42 /*`
43 Output:
44 [pre
45 ((0, 0), (5, 5))
46 ]
47 */
48 //]
49