• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Boost.Polygon's rectangle_data</title>
5<link rel="stylesheet" href="../../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../../index.html" title="Chapter 1. Geometry">
8<link rel="up" href="../boost_polygon.html" title="Boost.Polygon">
9<link rel="prev" href="point_data.html" title="Boost.Polygon's point_data">
10<link rel="next" href="polygon_data.html" title="Boost.Polygon's polygon_data">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="point_data.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost_polygon.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="polygon_data.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h5 class="title">
27<a name="geometry.reference.adapted.boost_polygon.rectangle_data"></a><a class="link" href="rectangle_data.html" title="Boost.Polygon's rectangle_data">Boost.Polygon's
28          rectangle_data</a>
29</h5></div></div></div>
30<p>
31            Boost.Polygon's rectangle type (boost::polygon::rectangle_data) is adapted
32            to the Boost.Geometry Point Concept.
33          </p>
34<h6>
35<a name="geometry.reference.adapted.boost_polygon.rectangle_data.h0"></a>
36            <span class="phrase"><a name="geometry.reference.adapted.boost_polygon.rectangle_data.description"></a></span><a class="link" href="rectangle_data.html#geometry.reference.adapted.boost_polygon.rectangle_data.description">Description</a>
37          </h6>
38<p>
39            Boost.Polygon's points (as well as polygons) can be used by Boost.Geometry.
40            The two libraries can therefore be used together. Using a boost::polygon::rectangle_data&lt;...&gt;,
41            algorithms from both Boost.Polygon and Boost.Geometry can be called.
42          </p>
43<h6>
44<a name="geometry.reference.adapted.boost_polygon.rectangle_data.h1"></a>
45            <span class="phrase"><a name="geometry.reference.adapted.boost_polygon.rectangle_data.model_of"></a></span><a class="link" href="rectangle_data.html#geometry.reference.adapted.boost_polygon.rectangle_data.model_of">Model
46            of</a>
47          </h6>
48<p>
49            <a class="link" href="../../concepts/concept_box.html" title="Box Concept">Box Concept</a>
50          </p>
51<h6>
52<a name="geometry.reference.adapted.boost_polygon.rectangle_data.h2"></a>
53            <span class="phrase"><a name="geometry.reference.adapted.boost_polygon.rectangle_data.header"></a></span><a class="link" href="rectangle_data.html#geometry.reference.adapted.boost_polygon.rectangle_data.header">Header</a>
54          </h6>
55<p>
56            <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="identifier">boost_polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
57          </p>
58<p>
59            The standard header <code class="computeroutput"><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span></code>
60            does not include this header.
61          </p>
62<h6>
63<a name="geometry.reference.adapted.boost_polygon.rectangle_data.h3"></a>
64            <span class="phrase"><a name="geometry.reference.adapted.boost_polygon.rectangle_data.example"></a></span><a class="link" href="rectangle_data.html#geometry.reference.adapted.boost_polygon.rectangle_data.example">Example</a>
65          </h6>
66<p>
67            Shows how to use Boost.Polygon rectangle_data within Boost.Geometry
68          </p>
69<p>
70</p>
71<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
72<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
73<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">adapted</span><span class="special">/</span><span class="identifier">boost_polygon</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
74
75<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
76<span class="special">{</span>
77    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">::</span><span class="identifier">rectangle_data</span><span class="special">&lt;</span><span class="keyword">int</span><span class="special">&gt;</span> <span class="identifier">rect</span><span class="special">;</span>
78
79    <span class="identifier">rect</span> <span class="identifier">b</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">::</span><span class="identifier">construct</span><span class="special">&lt;</span><span class="identifier">rect</span><span class="special">&gt;(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="number">3</span><span class="special">,</span> <span class="number">4</span><span class="special">);</span>
80
81    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Area (using Boost.Geometry): "</span>
82        <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">area</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
83    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Area (using Boost.Polygon): "</span>
84        <span class="special">&lt;&lt;</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">::</span><span class="identifier">area</span><span class="special">(</span><span class="identifier">b</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
85
86    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
87<span class="special">}</span>
88</pre>
89<p>
90          </p>
91<p>
92            Output:
93          </p>
94<pre class="programlisting">Area (using Boost.Geometry): 4
95Area (using Boost.Polygon): 4
96</pre>
97</div>
98<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
99<td align="left"></td>
100<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
101      Wulkiewicz, Oracle and/or its affiliates<p>
102        Distributed under the Boost Software License, Version 1.0. (See accompanying
103        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
104      </p>
105</div></td>
106</tr></table>
107<hr>
108<div class="spirit-nav">
109<a accesskey="p" href="point_data.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../boost_polygon.html"><img src="../../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../../index.html"><img src="../../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="polygon_data.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
110</div>
111</body>
112</html>
113