• 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 // Copyright (c) 2014 Adam Wulkiewicz, Lodz, Poland.
6 
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
10 
11 //[boost_polygon_box
12 //`Shows how to use Boost.Polygon rectangle_data within Boost.Geometry
13 
14 #include <iostream>
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/adapted/boost_polygon.hpp>
17 
main()18 int main()
19 {
20     typedef boost::polygon::rectangle_data<int> rect;
21 
22     rect b = boost::polygon::construct<rect>(1, 2, 3, 4);
23 
24     std::cout << "Area (using Boost.Geometry): "
25         << boost::geometry::area(b) << std::endl;
26     std::cout << "Area (using Boost.Polygon): "
27         << boost::polygon::area(b) << std::endl;
28 
29     return 0;
30 }
31 
32 //]
33 
34 //[boost_polygon_box_output
35 /*`
36 Output:
37 [pre
38 Area (using Boost.Geometry): 4
39 Area (using Boost.Polygon): 4
40 ]
41 */
42 //]
43