]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/polygon/doc/gtl_polygon_with_holes_concept.htm
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / polygon / doc / gtl_polygon_with_holes_concept.htm
CommitLineData
7c673cae
FG
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
3 xmlns:v="urn:schemas-microsoft-com:vml"
4 xmlns:o="urn:schemas-microsoft-com:office:office"
5 xmlns:(null)1="http://www.w3.org/TR/REC-html40" lang="en">
6<head>
7<!--
8 Copyright 2009-2010 Intel Corporation
9 license banner
10-->
11 <title>Boost Polygon Library: Polygon With Holes Concept</title>
12 <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />
13<!-- <link type="text/css" rel="stylesheet" href="adobe_source.css"> -->
14</head>
15<body>
16<table style="margin: 0pt; padding: 0pt; width: 100%;" border="0"
17 cellpadding="0" cellspacing="0">
18 <tbody>
19 <tr>
20 <td style="background-color: rgb(238, 238, 238);" nowrap="1"
21 valign="top">
22 <div style="padding: 5px;" align="center"> <img
23 src="images/boost.png" border="0" height="86" width="277" /><a
24 title="www.boost.org home page" href="http://www.boost.org/"
25 tabindex="2" style="border: medium none ;"> </a> </div>
26 <div style="margin: 5px;">
27 <h3 class="navbar">Contents</h3>
28 <ul>
29 <li><a href="index.htm">Boost.Polygon Main Page</a></li>
30 <li><a href="gtl_design_overview.htm">Design Overview</a></li>
31 <li><a href="gtl_isotropy.htm">Isotropy</a></li>
32 <li><a href="gtl_coordinate_concept.htm">Coordinate Concept</a></li>
33 <li><a href="gtl_interval_concept.htm">Interval Concept</a></li>
34 <li><a href="gtl_point_concept.htm">Point Concept</a></li>
35 <li><a href="gtl_segment_concept.htm">Segment Concept</a></li>
36 <li><a href="gtl_rectangle_concept.htm">Rectangle Concept</a></li>
37 <li><a href="gtl_polygon_90_concept.htm">Polygon 90 Concept</a></li>
38 <li><a href="gtl_polygon_90_with_holes_concept.htm">Polygon 90
39With Holes Concept</a></li>
40 <li><a href="gtl_polygon_45_concept.htm">Polygon 45 Concept</a></li>
41 <li><a href="gtl_polygon_45_with_holes_concept.htm">Polygon 45
42With Holes Concept</a></li>
43 <li><a href="gtl_polygon_concept.htm">Polygon Concept</a></li>
44 <li>Polygon With Holes Concept</li>
45 <li><a href="gtl_polygon_90_set_concept.htm">Polygon 90 Set
46Concept</a></li>
47 <li><a href="gtl_polygon_45_set_concept.htm">Polygon 45 Set
48Concept</a></li>
49 <li><a href="gtl_polygon_set_concept.htm">Polygon Set Concept</a></li>
50 <li><a href="gtl_connectivity_extraction_90.htm">Connectivity
51Extraction 90</a></li>
52 <li><a href="gtl_connectivity_extraction_45.htm">Connectivity
53Extraction 45</a></li>
54 <li><a href="gtl_connectivity_extraction.htm">Connectivity
55Extraction</a></li>
56 <li><a href="gtl_property_merge_90.htm">Property Merge 90</a></li>
57 <li><a href="gtl_property_merge_45.htm">Property Merge 45</a></li>
58 <li><a href="gtl_property_merge.htm">Property Merge</a></li>
59 <li><a href="voronoi_main.htm">Voronoi Main Page<br />
60 </a></li>
61 <li><a href="voronoi_benchmark.htm">Voronoi Benchmark</a><br />
62 </li>
63 <li><a href="voronoi_builder.htm">Voronoi Builder</a></li>
64 <li><a href="voronoi_diagram.htm">Voronoi Diagram</a></li>
65 </ul>
66 <h3 class="navbar">Other Resources</h3>
67 <ul>
68 <li><a href="GTL_boostcon2009.pdf">GTL Boostcon 2009 Paper</a></li>
69 <li><a href="GTL_boostcon_draft03.pdf">GTL Boostcon 2009
70Presentation</a></li>
71 <li><a href="analysis.htm">Performance Analysis</a></li>
72 <li><a href="gtl_tutorial.htm">Layout Versus Schematic Tutorial</a></li>
73 <li><a href="gtl_minkowski_tutorial.htm">Minkowski Sum Tutorial</a></li>
74 <li><a href="voronoi_basic_tutorial.htm">Voronoi Basic Tutorial</a></li>
75 <li><a href="voronoi_advanced_tutorial.htm">Voronoi Advanced
76Tutorial</a></li>
77 </ul>
78 </div>
79 <h3 class="navbar">Polygon Sponsor</h3>
80 <div style="padding: 5px;" align="center"> <img
81 src="images/intlogo.gif" border="0" height="51" width="127" /><a
82 title="www.adobe.com home page" href="http://www.adobe.com/"
83 tabindex="2" style="border: medium none ;"> </a> </div>
84 </td>
85 <td
86 style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
87 valign="top" width="100%">
88<!-- End Header --><br />
89 <p>
90 </p>
91 <h1>Polygon With Holes Concept</h1>
92 <p> </p>
93 <p>The polygon_with_holes concept tag is <font face="Courier New">
94polygon_with_holes_concept</font></p>
95 <p> To register a user defined type as a model of <font
96 face="Times New Roman">polygon_with_holes </font>concept, specialize
97the geometry concept meta-function for that type.&nbsp; In the example
98below CPolygonWithHoles is registered as a model of polygon<font
99 face="Times New Roman">_with_holes&nbsp;</font> concept.</p>
100 <p> <font face="Courier New">template &lt;&gt;<br />
101struct geometry_concept&lt;CPolygonWithHoles&gt; { typedef
102polygon_with_holes_concept type; };</font></p>
103 <p> <font face="Times New Roman">The semantic of a
104polygon_with_holes is a polygon that it can provide iterators over
105holes that are also polygon.&nbsp; A mutable polygon_with_holes must
106also be able to set its geometry based on an interator range over
107polygon holes.&nbsp; There is no convention of winding of holes
108enforced within the library. </font></p>
109 <p> <font face="Times New Roman">Below is shown the default
110polygon with holes traits.&nbsp; Specialization of these traits is
111required for types that don't conform to the default behavior.&nbsp;
112Note, these traits are used by all polygon with holes concepts.</font></p>
113 <p><font face="Courier New">template &lt;typename T, typename
114enable = void&gt;<br />
115struct polygon_with_holes_traits {<br />
116&nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::iterator_holes_type
117iterator_holes_type;<br />
118&nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::hole_type hole_type;<br />
119&nbsp;&nbsp;&nbsp;&nbsp; static inline iterator_holes_type
120begin_holes(const T&amp; t) {<br />
121&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
122t.begin_holes();<br />
123&nbsp;&nbsp;&nbsp;&nbsp; }<br />
124&nbsp;&nbsp;&nbsp;&nbsp; static inline iterator_holes_type
125end_holes(const T&amp; t) {<br />
126&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
127t.end_holes();<br />
128&nbsp;&nbsp;&nbsp;&nbsp; }<br />
129&nbsp;&nbsp;&nbsp;&nbsp; static inline unsigned int size_holes(const
130T&amp; t) {<br />
131&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
132t.size_holes();<br />
133&nbsp;&nbsp;&nbsp;&nbsp; }<br />
134};</font></p>
135 <p><font face="Courier New">template &lt;typename T, typename
136enable = void&gt;<br />
137struct polygon_with_holes_mutable_traits {<br />
138&nbsp;&nbsp;&nbsp;&nbsp; template &lt;typename iT&gt;<br />
139&nbsp;&nbsp;&nbsp;&nbsp; static inline T&amp; set_holes(T&amp; t, iT
140inputBegin, iT inputEnd) {<br />
141&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
142t.set_holes(inputBegin, inputEnd);<br />
143&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return t;<br />
144&nbsp;&nbsp;&nbsp;&nbsp; }<br />
145};</font></p>
146 <p>An object that is a model of <font face="Courier New">
147polygon_with_holes_concept</font> can be viewed as a model of any of
148its refinements if it is determined at runtime to conform to the
149restriction of those concepts.&nbsp; This concept casting is
150accomplished through the
151 <font face="Courier New">view_as&lt;&gt;()</font> function.</p>
152 <p><font face="Courier New">view_as&lt;rectangle_concept&gt;(polygon_with_holes_object)</font><br />
153 <font face="Courier New">view_as&lt;polygon_90_concept&gt;(polygon_with_holes_object)</font><br />
154 <font face="Courier New">view_as&lt;polygon_90_with_holes_concept&gt;(polygon_with_holes_object)</font><br />
155 <font face="Courier New">view_as&lt;polygon_45_concept&gt;(polygon_with_holes_object)</font><br />
156 <font face="Courier New">view_as&lt;polygon_45_with_holes_concept&gt;(polygon_with_holes_object)</font><br />
157 <font face="Courier New">view_as&lt;polygon_concept&gt;(polygon_with_holes_object)</font></p>
158 <p>The return value of <font face="Courier New">view_as&lt;&gt;()</font>
159can be passed into any interface that expects an object of the
160conceptual type specified in its template parameter. </p>
161 <h2>Functions</h2>
162 <table id="table1" border="1" width="100%">
163 <tbody>
164 <tr>
165 <td width="586"><font face="Courier New">template
166&lt;typename T&gt;<br />
167point_iterator_type <b>begin_points</b>(const T&amp; polygon)</font></td>
168 <td><font face="Times New Roman">Expects a model of
169polygon_with_holes.&nbsp; Returns the begin iterator over the range of
170points that correspond to vertices of the polygon.</font></td>
171 </tr>
172 <tr>
173 <td width="586"><font face="Courier New">template
174&lt;typename T&gt;<br />
175point_iterator_type <b>end_points</b>(const T&amp; polygon)</font></td>
176 <td><font face="Times New Roman">Expects a model of
177polygon_with_holes.&nbsp; Returns the end iterator over the range of
178points that correspond to vertices of the polygon.</font></td>
179 </tr>
180 <tr>
181 <td width="586"><font face="Courier New">template
182&lt;typename T&gt;<br />
183hole_iterator_type <b>begin_holes</b>(const T&amp; polygon)</font></td>
184 <td><font face="Times New Roman">Expects a model of
185polygon_with_holes.&nbsp; Returns the begin iterator over the range of
186coordinates that correspond to horizontal and vertical edges.</font></td>
187 </tr>
188 <tr>
189 <td width="586"><font face="Courier New">template
190&lt;typename T&gt;<br />
191hole_iterator_type <b>end_holes</b>(const T&amp; polygon)</font></td>
192 <td><font face="Times New Roman">Expects a model of
193polygon_with_holes.&nbsp; Returns the end iterator over the range of
194coordinates that correspond to horizontal and vertical edges.</font></td>
195 </tr>
196 <tr>
197 <td width="586"><font face="Courier New">template
198&lt;typename T, typename iterator&gt;<br />
199void <b>set_points</b>(T&amp; polygon, iterator b, iterator e)</font></td>
200 <td><font face="Times New Roman">Expects a model of
201polygon_with_holes.&nbsp;&nbsp; Sets the polygon to the point data
202range [b,e) that corresponds to vertices of a polygon.&nbsp; </font></td>
203 </tr>
204 <tr>
205 <td width="586"><font face="Courier New">template
206&lt;typename T, typename iterator&gt;<br />
207void <b>set_holes</b>(T&amp; polygon, iterator b, iterator e)</font></td>
208 <td><font face="Times New Roman">Expects a model of
209polygon_with_holes.&nbsp;&nbsp; Sets the polygon holes to the hole data
210range [b,e)</font></td>
211 </tr>
212 <tr>
213 <td width="586"><font face="Courier New">template
214&lt;typename T&gt;<br />
215unsigned int <b>size</b>(const T&amp; polygon)</font></td>
216 <td><font face="Times New Roman">Returns the number of
217edges in the outer shell of the polygon_with_holes.&nbsp; Does not
218include sizes of the holes.</font></td>
219 </tr>
220 <tr>
221 <td width="586"><font face="Courier New">template
222&lt;typename T1, typename T2&gt;<br />
223T1&amp; <b>assign</b>(T1&amp; left, const T2&amp; right)</font></td>
224 <td>Copies data from right object that models
225polygon_with_holes or one of its refinements into left object that
226models polygon_with_holes.</td>
227 </tr>
228 <tr>
229 <td width="586"><font face="Courier New">template
230&lt;typename T, typename point_type&gt;<br />
231bool <b>contains</b>(const T&amp;, const point_type&amp; point, <br />
232&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
233bool consider_touch=true)</font></td>
234 <td>Given an object that models polygon_with_holes and an
235object that models point, returns true if the polygon shell contains
236the point and one of its holes does not contain the point.&nbsp; If the
237consider_touch flag is true will return true if the point lies along
238the boundary of the polygon or one of its holes.</td>
239 </tr>
240 <tr>
241 <td width="586"><font face="Courier New">// get the center
242coordinate<br />
243template &lt;typename T, typename point_type&gt;<br />
244void <b>center</b>(point_type&amp; p, const T&amp; polygon)</font></td>
245 <td>Sets object that models point to the center point of
246the bounding box of an object that models polygon_with_holes.</td>
247 </tr>
248 <tr>
249 <td width="586"><font face="Courier New">template
250&lt;typename T, typename rectangle_type&gt;<br />
251bool <b>extents</b>(rectangle_type&amp; bbox, const T&amp; polygon)</font></td>
252 <td>Sets object that models rectangle to the bounding box
253of an object that models polygon_with_holes and returns true.&nbsp;
254Returns false and leaves bbox unchanged if polygon is empty.</td>
255 </tr>
256 <tr>
257 <td width="586"><font face="Courier New">template
258&lt;typename T&gt;<br />
259manhattan_area_type <b>area</b>(const T&amp; polygon)</font></td>
260 <td>Returns the area of an object that models
261polygon_with_holes including subtracting the area of its holes from the
262area of the outer shell polygon.</td>
263 </tr>
264 <tr>
265 <td width="586"><font face="Courier New">template
266&lt;typename T&gt;<br />
267direction_1d <b>winding</b>(const T&amp; polygon)</font></td>
268 <td>Returns the winding direction of an object that models
269polygon_with_holes, LOW == CLOCKWISE, HIGH = COUNTERCLOCKWISE.</td>
270 </tr>
271 <tr>
272 <td width="586"><font face="Courier New">template
273&lt;typename T&gt;<br />
274coordinate_difference <b>perimeter</b>(const T&amp; polygon)</font></td>
275 <td>Returns the perimeter length of an object that models
276polygon, including the perimeters of the holes.</td>
277 </tr>
278 <tr>
279 <td width="586"><font face="Courier New">template
280&lt;typename T, typename transform_type&gt;<br />
281T&amp; <b>transform</b>(T&amp; polygon, const transform_type&amp;)</font></td>
282 <td>Applies transform() on the vertices of polygon and sets
283the polygon to that described by the result of transforming its
284vertices.&nbsp; Also applies transform() on the holes of the polygon.</td>
285 </tr>
286 <tr>
287 <td width="586"><font face="Courier New">template
288&lt;typename T&gt;<br />
289T&amp; <b>scale_up</b>(T&amp; polygon, unsigned_area_type factor)</font></td>
290 <td>Scales up outer shell and holes of an object that
291models polygon by unsigned factor.</td>
292 </tr>
293 <tr>
294 <td width="586"><font face="Courier New">template
295&lt;typename T&gt;<br />
296T&amp; <b>scale_down</b>(T&amp; polygon, unsigned_area_type factor)</font></td>
297 <td>Scales down outer shell and holes of an object that
298models polygon by unsigned factor.</td>
299 </tr>
300 <tr>
301 <td width="586"><font face="Courier New">template
302&lt;typename T, scaling_type&gt;<br />
303T&amp; <b>scale</b>(T&amp; rectangle, double scaling) </font></td>
304 <td>Scales outer shell and holes of an object that models
305polygon by floating point factor.</td>
306 </tr>
307 <tr>
308 <td width="586"><font face="Courier New">template
309&lt;typename T&gt;<br />
310T&amp; <b>move</b>(T&amp; polygon, orientation_2d,<br />
311&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_difference
312displacement)</font></td>
313 <td>Adds displacement value to coordinate indicated by
314orientation_2d of vertices of an object that models polygon .</td>
315 </tr>
316 <tr>
317 <td width="586"><font face="Courier New">template
318&lt;typename polygon_type, typename point_type&gt;<br />
319polygon_type&amp; <b>convolve</b>(polygon_type&amp; polygon,<br />
320&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
321const point_type&amp; point)</font></td>
322 <td>Convolves coordinate values of point with the outer
323shell and holes of an object that models polygon_with_holes.</td>
324 </tr>
325 </tbody>
326 </table>
327 <h1>Polygon With Holes Data</h1>
328 <p> </p>
329 <p>The library provides a model of polygon with holes concept
330declared
331 <font face="Courier New">template&lt;typename T&gt;
332polygon_with_holes_data </font>where T is the coordinate type.</p>
333 <p>This data type is used internally when a polygon with holes is
334needed and is available to the library user who finds it convenient to
335use a library polygon data type instead of providing their own.&nbsp;
336The data type is implemented to be convenient to use with the library
337traits.</p>
338 <h2>Members</h2>
339 <table id="table2" border="1" width="100%">
340 <tbody>
341 <tr>
342 <td width="586"><b><font face="Courier New">geometry_type</font></b></td>
343 <td><font face="Times New Roman">polygon_with_holes_concept</font></td>
344 </tr>
345 <tr>
346 <td width="586"><b><font face="Courier New">coordinate_type</font></b></td>
347 <td><font face="Times New Roman">T</font></td>
348 </tr>
349 <tr>
350 <td width="586"><b><font face="Courier New">iterator_type</font></b></td>
351 <td>Iterator over vertices point_data&lt;T&gt; vertices of
352polygon</td>
353 </tr>
354 <tr>
355 <td width="586"><b><font face="Courier New">iterator_holes_type</font></b></td>
356 <td><font face="Times New Roman">Iterator over hole
357polygons of type polygon_data&lt;T&gt;.</font></td>
358 </tr>
359 <tr>
360 <td width="586"><font face="Courier New"><b>polygon_with_holes_data</b>()</font></td>
361 <td><font face="Times New Roman">Default constructs the </font>polygon.</td>
362 </tr>
363 <tr>
364 <td width="586"><font face="Courier New"><b>polygon_with_holes_data</b>(const
365polygon_with_holes_data&amp; that)</font></td>
366 <td><font face="Times New Roman">Copy construct</font></td>
367 </tr>
368 <tr>
369 <td width="586"><font face="Courier New">polygon_with_holes_data&amp;
370 <b> <br />
371operator=</b>(const polygon_with_holes_data&amp; that)</font></td>
372 <td>Assignment operator.</td>
373 </tr>
374 <tr>
375 <td width="586"><font face="Courier New">template
376&lt;typename T2&gt;<b> </b> polygon_with_holes_data&amp;<b>&nbsp; <br />
377operator=</b>(const T2&amp; that) const</font></td>
378 <td>Assign from an object that is a model of polygon with
379holes.</td>
380 </tr>
381 <tr>
382 <td width="586"><font face="Courier New">iterator_type <b>begin</b>()
383const</font></td>
384 <td>Get the begin iterator over vertices of the polygon.</td>
385 </tr>
386 <tr>
387 <td width="586"><font face="Courier New">iterator_type <b>end</b>()
388const</font></td>
389 <td>Get the end iterator over vertices of the polygon.</td>
390 </tr>
391 <tr>
392 <td width="586"><font face="Courier New">iterator_hole_type
393 <b>begin_holes</b>() const</font></td>
394 <td>Get the begin compact iterator over non-redundant
395coordinates of the polygon.</td>
396 </tr>
397 <tr>
398 <td width="586"><font face="Courier New">iterator_hole_type
399 <b>end_holes</b>() const</font></td>
400 <td>Get the end compact iterator over non-redundant
401coordinates of the polygon.</td>
402 </tr>
403 <tr>
404 <td width="586"><font face="Courier New">std::size_t <b>size</b>()
405const</font></td>
406 <td>Get the number of elements in the sequence stored to
407the polygon, usually equal to the number of edges of the polygon.</td>
408 </tr>
409 <tr>
410 <td width="586"><font face="Courier New">std::size_t <b>size_holes</b>()
411const</font></td>
412 <td>Get the number of holes in the polygon</td>
413 </tr>
414 <tr>
415 <td width="586"><font face="Courier New">template
416&lt;typename iT&gt;<b>&nbsp; <br />
417 </b>void <b>set</b>(iT begin_points, iT end_points)</font></td>
418 <td>Sets the polygon to the iterator range of points. </td>
419 </tr>
420 <tr>
421 <td width="586"><font face="Courier New">template
422&lt;typename iT&gt;<b>&nbsp; <br />
423 </b>void <b>set_holes</b>(iT begin_holes, iT end_choless)</font></td>
424 <td>Sets the polygon holes the iterator range of hole
425polygons.&nbsp; These polygons in the input range may be either
426polygon_data or polygon_with_holes_data or any type that provides begin
427and end member functions to iterate over point_data&lt;T&gt;.</td>
428 </tr>
429 </tbody>
430 </table>
431 </td>
432 </tr>
433 <tr>
434 <td style="background-color: rgb(238, 238, 238);" nowrap="1"
435 valign="top"> &nbsp;</td>
436 <td
437 style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
438 valign="top" width="100%">
439 <table class="docinfo" id="table3" frame="void" rules="none">
440 <colgroup> <col class="docinfo-name" /><col
441 class="docinfo-content" /> </colgroup> <tbody valign="top">
442 <tr>
443 <th class="docinfo-name">Copyright:</th>
444