• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>strategy::buffer::join_miter</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="../strategies.html" title="Strategies">
9<link rel="prev" href="strategy_buffer_join_round.html" title="strategy::buffer::join_round">
10<link rel="next" href="strategy_buffer_end_round.html" title="strategy::buffer::end_round">
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="strategy_buffer_join_round.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.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="strategy_buffer_end_round.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="geometry.reference.strategies.strategy_buffer_join_miter"></a><a class="link" href="strategy_buffer_join_miter.html" title="strategy::buffer::join_miter">strategy::buffer::join_miter</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635671282672"></a><a class="indexterm" name="idm45635671281984"></a><a class="indexterm" name="idm45635671281296"></a>
31Let the buffer create sharp corners.
32        </p>
33<h6>
34<a name="geometry.reference.strategies.strategy_buffer_join_miter.h0"></a>
35          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.description"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.description">Description</a>
36        </h6>
37<p>
38          This strategy can be used as JoinStrategy for the buffer algorithm. It
39          creates a sharp corners around each convex vertex. It can be applied for
40          (multi)linestrings and (multi)polygons. If corners are sharp by themselves,
41          the miters might become very long. Therefore there is a limit (miter_limit),
42          in terms of the used distance, which limits their length. The miter is
43          not changed to a bevel form (as done in some other software), it is just
44          adapted to the specified miter_limit but keeps its miter form. If the buffer
45          distance is 5.0, and the miter limit is 2.0, generated points will be located
46          at a distance of at most 10.0 (2*5) units. This strategy is only applicable
47          for Cartesian coordinate systems.
48        </p>
49<h6>
50<a name="geometry.reference.strategies.strategy_buffer_join_miter.h1"></a>
51          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.synopsis"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.synopsis">Synopsis</a>
52        </h6>
53<p>
54</p>
55<pre class="programlisting"><span class="keyword">class</span> <span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">join_miter</span>
56<span class="special">{</span>
57  <span class="comment">// ...</span>
58<span class="special">};</span>
59</pre>
60<p>
61        </p>
62<h6>
63<a name="geometry.reference.strategies.strategy_buffer_join_miter.h2"></a>
64          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.constructor_s_"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.constructor_s_">Constructor(s)</a>
65        </h6>
66<div class="informaltable"><table class="table">
67<colgroup>
68<col>
69<col>
70<col>
71</colgroup>
72<thead><tr>
73<th>
74                  <p>
75                    Function
76                  </p>
77                </th>
78<th>
79                  <p>
80                    Description
81                  </p>
82                </th>
83<th>
84                  <p>
85                    Parameters
86                  </p>
87                </th>
88</tr></thead>
89<tbody><tr>
90<td>
91                  <p>
92</p>
93<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">join_miter</span><span class="special">(</span><span class="keyword">double</span> <span class="identifier">miter_limit</span> <span class="special">=</span> <span class="number">5.0</span><span class="special">)</span></pre>
94<p>
95                  </p>
96                </td>
97<td>
98                  <p>
99                    Constructs the strategy.
100                  </p>
101                </td>
102<td>
103                  <p>
104                    <span class="bold"><strong>double</strong></span>: <span class="emphasis"><em>miter_limit</em></span>:
105                    The miter limit, to avoid excessively long miters around sharp
106                    corners
107                  </p>
108                </td>
109</tr></tbody>
110</table></div>
111<h6>
112<a name="geometry.reference.strategies.strategy_buffer_join_miter.h3"></a>
113          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.header"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.header">Header</a>
114        </h6>
115<p>
116          <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">strategies</span><span class="special">/</span><span class="identifier">cartesian</span><span class="special">/</span><span class="identifier">buffer_join_miter</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
117        </p>
118<h6>
119<a name="geometry.reference.strategies.strategy_buffer_join_miter.h4"></a>
120          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.example"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.example">Example</a>
121        </h6>
122<p>
123          Shows how the join_miter strategy can be used as a JoinStrategy to create
124          sharp corners
125        </p>
126<p>
127</p>
128<pre class="programlisting"><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>
129<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">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
130<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">geometries</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
131
132
133<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
134<span class="special">{</span>
135    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">point</span><span class="special">;</span>
136    <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">polygon</span><span class="special">&lt;</span><span class="identifier">point</span><span class="special">&gt;</span> <span class="identifier">polygon</span><span class="special">;</span>
137
138    <span class="comment">// Declare the join_miter strategy</span>
139    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">join_miter</span> <span class="identifier">join_strategy</span><span class="special">;</span>
140
141    <span class="comment">// Declare other strategies</span>
142    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">distance_symmetric</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">distance_strategy</span><span class="special">(</span><span class="number">0.5</span><span class="special">);</span>
143    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">end_flat</span> <span class="identifier">end_strategy</span><span class="special">;</span>
144    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">side_straight</span> <span class="identifier">side_strategy</span><span class="special">;</span>
145    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">strategy</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">::</span><span class="identifier">point_circle</span> <span class="identifier">point_strategy</span><span class="special">;</span>
146
147    <span class="comment">// Declare/fill a multi polygon</span>
148    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">multi_polygon</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;</span> <span class="identifier">mp</span><span class="special">;</span>
149    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"MULTIPOLYGON(((5 5,7 8,9 5,5 5)),((8 7,8 10,11 10,11 7,8 7)))"</span><span class="special">,</span> <span class="identifier">mp</span><span class="special">);</span>
150
151    <span class="comment">// Create the buffered geometry with sharp corners</span>
152    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">multi_polygon</span><span class="special">&lt;</span><span class="identifier">polygon</span><span class="special">&gt;</span> <span class="identifier">result</span><span class="special">;</span>
153    <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">buffer</span><span class="special">(</span><span class="identifier">mp</span><span class="special">,</span> <span class="identifier">result</span><span class="special">,</span>
154                <span class="identifier">distance_strategy</span><span class="special">,</span> <span class="identifier">side_strategy</span><span class="special">,</span>
155                <span class="identifier">join_strategy</span><span class="special">,</span> <span class="identifier">end_strategy</span><span class="special">,</span> <span class="identifier">point_strategy</span><span class="special">);</span>
156
157
158    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
159<span class="special">}</span>
160</pre>
161<p>
162        </p>
163<h6>
164<a name="geometry.reference.strategies.strategy_buffer_join_miter.h5"></a>
165          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.output"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.output">Output</a>
166        </h6>
167<p>
168          <span class="inlinemediaobject"><img src="../../../img/strategies/buffer_join_miter.png" alt="buffer_join_miter"></span>
169        </p>
170<h6>
171<a name="geometry.reference.strategies.strategy_buffer_join_miter.h6"></a>
172          <span class="phrase"><a name="geometry.reference.strategies.strategy_buffer_join_miter.see_also"></a></span><a class="link" href="strategy_buffer_join_miter.html#geometry.reference.strategies.strategy_buffer_join_miter.see_also">See
173          also</a>
174        </h6>
175<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
176<li class="listitem">
177              <a class="link" href="../algorithms/buffer/buffer_7_with_strategies.html" title="buffer (with strategies)">buffer
178              (with strategies)</a>
179            </li>
180<li class="listitem">
181              <a class="link" href="strategy_buffer_join_round.html" title="strategy::buffer::join_round">join_round</a>
182            </li>
183</ul></div>
184</div>
185<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
186<td align="left"></td>
187<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
188      Wulkiewicz, Oracle and/or its affiliates<p>
189        Distributed under the Boost Software License, Version 1.0. (See accompanying
190        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>)
191      </p>
192</div></td>
193</tr></table>
194<hr>
195<div class="spirit-nav">
196<a accesskey="p" href="strategy_buffer_join_round.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.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="strategy_buffer_end_round.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
197</div>
198</body>
199</html>
200