]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/polygon/doc/gtl_polygon_45_set_concept.htm
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / polygon / doc / gtl_polygon_45_set_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 45 Set 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><a href="gtl_polygon_with_holes_concept.htm">Polygon With
45Holes Concept</a></li>
46 <li><a href="gtl_polygon_90_set_concept.htm">Polygon 90 Set
47Concept</a></li>
48 <li>Polygon 45 Set Concept</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 45 Set Concept</h1>
92 <p> </p>
93 <p>The polygon_45_set concept tag is <font face="Courier New">
94polygon_45_set_concept</font></p>
95 <p> <font face="Times New Roman">The semantic of a
96polygon_45_set is zero or more geometry regions which have angles at
97the vertices that are multiples of 45-degrees relative to the
98coordinate axis.&nbsp; A Polygon 45 Set Concept makes no sense in
99floating point, but currently does not provide a static assert to
100prevent it from being used with floating point coordinates.&nbsp; The
101result of such use is undefined.&nbsp; When the intersection of two 45
102degree edges results in a vertex that is off the integer grid that case
103is handled by inserting a unit length edge between the two 45 degree
104edges near the off grid intersection point.&nbsp; In the case that data
105represented contains no 45-degree angles and is Manhattan a runtime
106check will default to the Manhattan algorithm.&nbsp; The results of
107which are identical to what the 45-degree algorithm would do, but
108obtained more efficiently.</font></p>
109 <p> <font face="Times New Roman">The motivation for providing
110the polygon_45_set is to extend the special case of Manhattan geometry
111capability of the library to encompass the slightly less common, but
112still important special case of geometry that is described by angles
113that are multiples of 45-degress with respect to the coordinate
114axis.&nbsp; This simplifies the implementation of geometry algorithms
115and affords many opportunities for optimization.&nbsp; 45-degree
116algorithms can be 50X faster than arbitrary angle algorithms and are
117required to provide a complete feature set that meets the performance
118requirements of application domains in which Manhattan and 45-degree
119geometry are a common special case.</font></p>
120 <p>Users are recommended to use std::vector and std::list of user
121defined polygons or library provided
122polygon_45_set_data&lt;coordinate_type&gt; objects.&nbsp; Lists and
123vectors of models of polygon_45_concept or
124polygon_45_with_holes_concept are automatically models of
125polygon_45_set_concept.</p>
126 <p>An object that is a model of <font face="Courier New">
127polygon_45_set_concept</font> can be viewed as a model of <font
128 face="Courier New">
129polygon_90_set_concept</font> if it is determined at runtime to conform
130to the restriction that all edges are axis-parallel.&nbsp; This concept
131casting is accomplished through the <font face="Courier New">view_as&lt;&gt;()</font>
132function.</p>
133 <p><font face="Courier New">view_as&lt;polygon_90_set_concept&gt;(polygon_set_object)</font></p>
134 <p>The return value of <font face="Courier New">view_as&lt;&gt;()</font>
135can be passed into any interface that expects an object of the
136conceptual type specified in its template parameter.&nbsp; Polygon sets
137cannot be viewed as single polygons or rectangles since it generally
138cannot be known whether a polygon set contains only a single polygon
139without converting to polygons.</p>
140 <h2>Operators</h2>
141 <p>The return type of some operators is the <font
142 face="Courier New">polygon_45_set_view</font> operator template
143type.&nbsp; This type is itself a model of the polygon 90 set concept,
144but furthermore can be used as an argument to the <font
145 face="Courier New">polygon_45_set_data</font> constructor and
146assignment operator.&nbsp; The operator template exists to eliminate
147temp copies of intermediate results when Boolean operators are chained
148together.</p>
149 <p>Operators are declared inside the namespace <font
150 face="Courier New">boost::polygon::operators</font>.</p>
151 <table id="table5" border="1" width="100%">
152 <tbody>
153 <tr>
154 <td width="586"><font face="Courier New">template
155&lt;typename T1, typename T2&gt;<br />
156polygon_45_set_view <b>operator</b>|(const T1&amp; l, const T2&amp; r)</font></td>
157 <td>Boolean OR operation (polygon set union).&nbsp; Accepts
158two objects that model polygon_45_set or one of its refinements.&nbsp;
159Returns an operator template that performs the operation on demand when
160chained or or nested in a library function call such as assign().&nbsp;
161O( n log n) runtime complexity and O(n) memory wrt vertices +
162intersections.</td>
163 </tr>
164 <tr>
165 <td width="586"><font face="Courier New">template
166&lt;typename T1, typename T2&gt;<br />
167polygon_45_set_view <b>operator</b>+(const T1&amp; l, const T2&amp; r)</font></td>
168 <td>Same as operator|.&nbsp; The plus sign is also used for
169OR operations in Boolean logic expressions.&nbsp; O( n log n) runtime
170complexity and O(n) memory wrt vertices + intersections.</td>
171 </tr>
172 <tr>
173 <td width="586"><font face="Courier New">template
174&lt;typename T1, typename T2&gt;<br />
175polygon_45_set_view <b>operator</b>&amp;(const T1&amp; l, const
176T2&amp; r)</font></td>
177 <td>Boolean AND operation (polygon set intersection).&nbsp;
178Accepts two objects that model polygon_45_set or one of its
179refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
180vertices + intersections.</td>
181 </tr>
182 <tr>
183 <td width="586"><font face="Courier New">template
184&lt;typename T1, typename T2&gt;<br />
185polygon_45_set_view <b>operator</b>*(const T1&amp; l, const T2&amp; r)</font></td>
186 <td>Same as operator&amp;.&nbsp; The multiplication symbol
187is also used for AND operations in Boolean logic expressions.&nbsp; O(
188n log n) runtime complexity and O(n) memory wrt vertices +
189intersections.</td>
190 </tr>
191 <tr>
192 <td width="586"><font face="Courier New">template
193&lt;typename T1, typename T2&gt;<br />
194polygon_45_set_view <b>operator</b>^(const T1&amp; l, const T2&amp; r)</font></td>
195 <td>Boolean XOR operation (polygon set
196disjoint-union).&nbsp; Accepts two objects that model polygon_45_set or
197one of its refinements.&nbsp; O( n log n) runtime complexity and O(n)
198memory wrt vertices + intersections.</td>
199 </tr>
200 <tr>
201 <td width="586"><font face="Courier New">template
202&lt;typename T1, typename T2&gt;<br />
203polygon_45_set_view <b>operator</b>-(const T1&amp; l, const T2&amp; r)</font></td>
204 <td>Boolean SUBTRACT operation (polygon set
205difference).&nbsp; Accepts two objects that model polygon_45_set or one
206of its refinements.&nbsp; O( n log n) runtime complexity and O(n)
207memory wrt vertices + intersections.</td>
208 </tr>
209 <tr>
210 <td width="586"><font face="Courier New">template
211&lt;typename T1, typename T2&gt;<br />
212T1&amp; <b>operator</b>|=(const T1&amp; l, const T2&amp; r)</font></td>
213 <td>Same as operator|, but with self assignment, left
214operand must model polygon_45_set and not one of it's
215refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
216vertices + intersections.</td>
217 </tr>
218 <tr>
219 <td width="586"><font face="Courier New">template
220&lt;typename T1, typename T2&gt;<br />
221T1&amp; <b>operator</b>+=(T1&amp; l, const T2&amp; r)</font></td>
222 <td>Same as operator+, but with self assignment, left
223operand must model polygon_45_set and not one of it's
224refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
225vertices + intersections.</td>
226 </tr>
227 <tr>
228 <td width="586"><font face="Courier New">template
229&lt;typename T1, typename T2&gt;<br />
230T1&amp; <b>operator</b>&amp;=(const T1&amp; l, const T2&amp; r)</font></td>
231 <td>Same as operator&amp;, but with self assignment, left
232operand must model polygon_45_set and not one of it's
233refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
234vertices + intersections.</td>
235 </tr>
236 <tr>
237 <td width="586"><font face="Courier New">template
238&lt;typename T1, typename T2&gt;<br />
239T1&amp; <b>operator</b>*=(T1&amp; l, const T2&amp; r)</font></td>
240 <td>Same as operator*, but with self assignment, left
241operand must model polygon_45_set and not one of it's
242refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
243vertices + intersections.</td>
244 </tr>
245 <tr>
246 <td width="586"><font face="Courier New">template
247&lt;typename T1, typename T2&gt;<br />
248T1&amp; <b>operator</b>^=(const T1&amp; l, const T2&amp; r)</font></td>
249 <td>Same as operator^, but with self assignment, left
250operand must model polygon_45_set and not one of it's
251refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
252vertices + intersections.</td>
253 </tr>
254 <tr>
255 <td width="586"><font face="Courier New">template
256&lt;typename T1, typename T2&gt;<br />
257T1&amp; <b>operator</b>-=(T1&amp; l, const T2&amp; r)</font></td>
258 <td>Same as operator-, but with self assignment, left
259operand must model polygon_45_set and not one of it's
260refinements.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
261vertices + intersections.</td>
262 </tr>
263 <tr>
264 <td width="586"><font face="Courier New">template
265&lt;typename T1&gt;<br />
266T1 <b>operator</b>+(const T1&amp;, coordinate_type bloating)</font></td>
267 <td>Performs resize operation, inflating by bloating
268ammount.&nbsp; If negative the result is a shrink instead of
269bloat.&nbsp; Note: returns result by value.&nbsp; O( n log n) runtime
270complexity and O(n) memory wrt vertices + intersections.</td>
271 </tr>
272 <tr>
273 <td width="586"><font face="Courier New">template
274&lt;typename T1, typename T2&gt;<br />
275T1 <b>operator</b>-(const T1&amp;, coordinate_type shrinking)</font></td>
276 <td>Performs resize operation, deflating by bloating
277ammount.&nbsp; If negative the result is a bloat instead of
278shrink.&nbsp; Note: returns result by value.&nbsp; O( n log n) runtime
279complexity and O(n) memory wrt vertices + intersections.</td>
280 </tr>
281 <tr>
282 <td width="586"><font face="Courier New">template
283&lt;typename T1, typename T2&gt;<br />
284T1&amp; <b>operator</b>+=(const T1&amp;, coordinate_type bloating)</font></td>
285 <td>Performs resize operation, inflating by bloating
286ammount.&nbsp; If negative the result is a shrink instead of
287bloat.&nbsp; Returns reference to modified argument.&nbsp; O( n log n)
288runtime complexity and O(n) memory wrt vertices + intersections.</td>
289 </tr>
290 <tr>
291 <td width="586"><font face="Courier New">template
292&lt;typename T1, typename T2&gt;<br />
293T1&amp; <b>operator</b>-=(const T1&amp;, coordinate_type shrinking)</font></td>
294 <td>Performs resize operation, deflating by bloating
295ammount.&nbsp; If negative the result is a bloat instead of
296shrink.&nbsp; Returns reference to modified argument.&nbsp; O( n log n)
297runtime complexity and O(n) memory wrt vertices + intersections.</td>
298 </tr>
299 </tbody>
300 </table>
301 <h2>Functions</h2>
302 <table id="table3" border="1" width="100%">
303 <tbody>
304 <tr>
305 <td width="586"><font face="Courier New">template
306&lt;typename T1, typename T2&gt;<br />
307T1&amp; <b>assign</b>(T1&amp; lvalue, const T2&amp; rvalue)</font></td>
308 <td>Eliminates overlaps in geometry and copies from an
309object that models polygon_45_set or any of its refinements into an
310object that models polygon_45_set.&nbsp; O( n log n) runtime complexity
311and O(n) memory wrt vertices + intersections.</td>
312 </tr>
313 <tr>
314 <td width="586"><font face="Courier New">template
315&lt;typename T1, typename T2&gt;<br />
316bool <b>equivalence</b>(const T1&amp; lvalue, const T2&amp; rvalue) </font></td>
317 <td>Returns true if an object that models polygon_45_set or
318one of its refinements covers the exact same geometric regions as
319another object that models polygon_45_set or one of its
320refinements.&nbsp; For example: two of polygon_45 objects.&nbsp; O( n
321log n) runtime complexity and O(n) memory wrt vertices + intersections.</td>
322 </tr>
323 <tr>
324 <td width="586"><font face="Courier New">template
325&lt;typename output_container_type, typename T&gt;<br />
326void <b>get_trapezoids</b>(output_container_type&amp; output, <br />
327&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
328const T&amp; polygon_set)</font></td>
329 <td>Output container is expected to be a standard
330container.&nbsp; Slices geometry of an object that models
331polygon_45_set or one of its refinements into non overlapping
332trapezoids along a vertical slicing orientation and appends them to the
333output, which must have a value type that models polygon_45,
334polygon_45_with_holes, polygon or polygon_with_holes.&nbsp;&nbsp; O( n
335log n) runtime complexity and O(n) memory wrt vertices.</td>
336 </tr>
337 <tr>
338 <td width="586"><font face="Courier New">template
339&lt;typename output_container_type, typename T&gt;<br />
340void <b>get_trapezoids</b>(output_container_type&amp; output, <br />
341&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
342const T&amp; polygon_set,<br />
343&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
344orientation_2d orient)</font></td>
345 <td>Output container is expected to be a standard
346container.&nbsp; Slices geometry of an object that models
347polygon_45_set or one of its refinements into non overlapping
348trapezoids along a the specified slicing orientation and appends them
349to the output, which must have a value type that models polygon_45,
350polygon_45_with_holes, polygon or polygon_with_holes.&nbsp;&nbsp; O( n
351log n) runtime complexity and O(n) memory wrt vertices.</td>
352 </tr>
353 <tr>
354 <td width="586"><font face="Courier New">template
355&lt;typename polygon_set_type&gt;<br />
356void <b>clear</b>(polygon_set_type&amp; polygon_set)</font></td>
357 <td>Makes the object empty of geometry.</td>
358 </tr>
359 <tr>
360 <td width="586"><font face="Courier New">template
361&lt;typename polygon_set_type&gt;<br />
362bool <b>empty</b>(const polygon_set_type&amp; polygon_set)</font></td>
363 <td>Checks whether the object is empty of geometry.&nbsp;
364Polygons that are completely covered by holes will result in empty
365returning true.&nbsp;&nbsp; O( n log n) runtime complexity and O(n)
366memory wrt vertices.</td>
367 </tr>
368 <tr>
369 <td width="586"><font face="Courier New">template
370&lt;typename T, typename rectangle_type&gt;<br />
371bool <b>extents</b>(rectangle_type&amp; extents_rectangle, <br />
372&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
373const T&amp; polygon_set)</font></td>
374 <td>Computes bounding box of an object that models
375polygon_45_set and stores it in an object that models rectangle.&nbsp;
376If the polygon set is empty returns false.&nbsp; If there are holes
377outside of shells they do not contribute to the extents of the polygon
378set.&nbsp;&nbsp; O( n log n) runtime complexity and O(n) memory wrt
379vertices.</td>
380 </tr>
381 <tr>
382 <td width="586"><font face="Courier New">template
383&lt;typename T&gt;<br />
384area_type <b>area</b>(const T&amp; polygon_set)</font></td>
385 <td>Computes the area covered by geometry in an object that
386models polygon_45_set.&nbsp;&nbsp; O( n log n) runtime complexity and
387O(n) memory wrt vertices.</td>
388 </tr>
389 <tr>
390 <td width="586"><font face="Courier New">template
391&lt;typename T1, typename T2&gt;<br />
392T1&amp; <b>interact</b>(T1&amp; a, const T2&amp; b)</font></td>
393 <td>Given an object that models polygon_45_set and an
394object that models polygon_45_set or one of its refinements, modifies a
395to retain only regions that overlap or touch regions in b.&nbsp;&nbsp;
396O( n log n) runtime complexity and O(n) memory wrt vertices plus
397intersections.</td>
398 </tr>
399 <tr>
400 <td width="586"><font face="Courier New">template
401&lt;typename T&gt;<br />
402T&amp; <b>self_intersect</b>(T&amp; polygon_set)</font></td>
403 <td>Given an object that models polygon_45_set that has
404self overlapping regions, modifies the argument to contain only the
405regions of overlap.&nbsp; O( n log n) runtime complexity and O(n)
406memory wrt vertices + intersections.</td>
407 </tr>
408 <tr>
409 <td width="586"><font face="Courier New">template
410&lt;typename T&gt;<br />
411T&amp; <b>self_xor</b>(T&amp; polygon_set)</font></td>
412 <td>Given an object that models polygon_45_set that has
413self overlapping regions, modifies the argument to contain only the
414regions that do not overlap.&nbsp; O( n log n) runtime complexity and
415O(n) memory wrt vertices + intersections.</td>
416 </tr>
417 <tr>
418 <td width="586"><font face="Courier New">template
419&lt;typename T&gt;<br />
420T&amp; <b>bloat</b>(T&amp; polygon_set, unsigned_area_type bloating)</font></td>
421 <td>Same as getting all the polygons, bloating them and
422putting them back.&nbsp; O( n log n) runtime complexity and O(n) memory
423wrt vertices + intersections.</td>
424 </tr>
425 <tr>
426 <td width="586"><font face="Courier New">template
427&lt;typename T&gt;<br />
428T&amp; <b>shrink</b>(T&amp; polygon_set, unsigned_area_type shrinking)</font></td>
429 <td>Same as getting all the polygons, shrinking them and
430overwriting the polygon set with the resulting regions.&nbsp; O( n log
431n) runtime complexity and O(n) memory wrt vertices + intersections.</td>
432 </tr>
433 <tr>
434 <td width="586"><font face="Courier New">template
435&lt;typename T, typename coord_type&gt;<br />
436T&amp; <b>resize</b>(T&amp; polygon_set, coord_type resizing,<br />
437&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RoundingOption
438rounding = CLOSEST, <br />
439&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CornerOption
440corner = INTERSECTION)</font></td>
441 <td>Same as bloat if resizing is positive, same as shrink
442if resizing is negative.&nbsp; RoundingOption is an enum that controls
443snapping of non-integer results of resizing 45 degree edges.&nbsp;
444CornerOption is an enum that controls how corner filling is
445performed.&nbsp; polygon_45_set_data.hpp defines these enums.&nbsp; O(
446n log n) runtime complexity and O(n) memory wrt vertices +
447intersections.</td>
448 </tr>
449 <tr>
450 <td width="586"><font face="Courier New">template
451&lt;typename T&gt;<br />
452T&amp; <b>grow_and</b>(T&amp; polygon_set, unsigned_area_type bloating)</font></td>
453 <td>Same as bloating non-overlapping regions and then
454applying self intersect to retain only the overlaps introduced by the
455bloat.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
456vertices + intersections.</td>
457 </tr>
458 <tr>
459 <td width="586"><font face="Courier New">template
460&lt;typename T&gt;<br />
461T&amp; <b>scale_up</b>(T&amp; polygon_set, unsigned_area_type factor)</font></td>
462 <td>Scales geometry up by unsigned factor.&nbsp; O( n log
463n) runtime complexity and O(n) memory wrt vertices.</td>
464 </tr>
465 <tr>
466 <td width="586"><font face="Courier New">template
467&lt;typename T&gt;<br />
468T&amp; <b>scale_down</b>(T&amp; polygon_set, unsigned_area_type factor)</font></td>
469 <td>Scales geometry down by unsigned factor.&nbsp; Snaps 45
470degree edges back to 45 degrees after division truncation leads to
471small changes in angle.&nbsp; O( n log n) runtime complexity and O(n)
472memory wrt vertices.</td>
473 </tr>
474 <tr>
475 <td width="586"><font face="Courier New">template
476&lt;typename T, typename scaling_type&gt;<br />
477T&amp; <b>scale</b>(polygon_set_type&amp; polygon_set, double scaling)</font></td>
478 <td>Scales geometry by multiplying by floating point
479factor.&nbsp;&nbsp; Snaps 45 degree edges back to 45 degrees after
480truncation of fractional results of multiply leads to small changes in
481angle.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
482vertices.</td>
483 </tr>
484 <tr>
485 <td width="586"><font face="Courier New">template
486&lt;typename T, typename transformation_type&gt;<br />
487T&amp; <b>transform</b>(T&amp; polygon_set,<br />
488&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
489const transformation_type&amp; transformation)</font></td>
490 <td>Applies transformation.transform() on all
491vertices.&nbsp; O( n log n) runtime complexity and O(n) memory wrt
492vertices.</td>
493 </tr>
494 <tr>
495 <td width="586"><font face="Courier New">template
496&lt;typename T&gt;<br />
497T&amp; <b>keep</b>(T&amp; polygon_set, <br />
498&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned_area_type min_area,<br />
499&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned_area_type max_area,<br />
500&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned_area_type min_width,<br />
501&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned_area_type max_width,<br />
502&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned_area_type
503min_height,<br />
504&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; unsigned_area_type
505max_height)</font></td>
506 <td>Retains only regions that satisfy the min/max criteria
507in the argument list.&nbsp; Note: useful for visualization to cull too
508small polygons.&nbsp; O( n log n) runtime complexity and O(n) memory
509wrt vertices.</td>
510 </tr>
511 </tbody>
512 </table>
513 <h1>Polygon 45 Set Data Object</h1>
514 <p> </p>
515 <p>The polygon 45 set data type encapsulates the internal data
516format that serves as the input to the sweep-line algorithm that
517implements polygon-clipping Boolean operations.&nbsp; It also
518internally keeps track of whether that data has been sorted or scanned
519and maintains the invariant that when its flags indicate that the data
520is sorted or scanned the data has not been changed to violate that
521assumption.&nbsp; Using the Polygon 45 Set Data type directly can be
522more efficient than using lists and vectors of polygons in the
523functions above because of the invariants it can enforce which provide
524the opportunity to maintain the data is sorted form rather than going
525all the way out to polygons then resorting those vertices for a
526subsequent operation.</p>
527 <p>The declaration of Polygon 45 Set Data is the following:</p>
528 <p><font face="Courier New">template &lt;typename T&gt;<br />
529class polygon_45_set_data;</font></p>
530 <p>The class is parameterized on the coordinate data type.&nbsp;
531Algorithms that benefit from knowledge of the invariants enforced by
532the class are implemented as member functions to provide them access to
533information about those invariants.&nbsp; </p>
534 <h2>Member Functions</h2>
535 <table id="table4" border="1" width="100%">
536 <tbody>
537 <tr>
538 <td width="586"><font face="Courier New"><b>polygon_45_set_data</b>()</font></td>
539 <td>Default constructor. </td>
540 </tr>
541 <tr>
542 <td width="586"><font face="Courier New">template
543&lt;typename iT&gt;<br />
544 <b>polygon_45_set_data</b>(iT input_begin, iT input_end)</font></td>
545 <td>Construct from an iterator range of insertable objects.</td>
546 </tr>
547 <tr>
548 <td width="586"><font face="Courier New"> <b>polygon_45_set_data</b>(const
549polygon_45_set_data&amp; that)</font></td>
550 <td>Copy construct.</td>
551 </tr>
552 <tr>
553 <td width="586"><font face="Courier New">template
554&lt;typename l, typename r, typename op&gt;<br />
555 <b>polygon_45_set_data</b>(const
556polygon_45_set_view&lt;l,r,op&gt;&amp; t)</font></td>
557 <td>Copy construct from a Boolean operator template.</td>
558 </tr>
559 <tr>
560 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
561 <br />
562 <b>operator=</b>(const polygon_45_set_data&amp; that)</font></td>
563 <td>Assignment from another polygon set, may change
564scanning orientation.</td>
565 </tr>
566 <tr>
567 <td width="586"><font face="Courier New">template
568&lt;typename l, typename r, typename op&gt;<br />
569polygon_45_set_data&amp; <br />
570 <b>operator=</b>(const polygon_45_set_view&lt;l, r,
571op&gt;&amp; that)</font></td>
572 <td>Assignment from a Boolean operator template.</td>
573 </tr>
574 <tr>
575 <td width="586"><font face="Courier New">template
576&lt;typename geometry_object&gt;<br />
577polygon_45_set_data&amp; <b>operator=</b>(const geometry_object&amp;
578geo)</font></td>
579 <td>Assignment from an insertable object.</td>
580 </tr>
581 <tr>
582 <td width="586"><font face="Courier New">
583template &lt;typename iT&gt;<br />
584void <b>insert</b>(iT input_begin, iT input_end, <br />
585&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool
586is_hole = false)</font></td>
587 <td>Insert objects of an iterator range.&nbsp; If is_hole
588is true inserts subtractive regions.&nbsp; Linear wrt the number of
589vertices added.</td>
590 </tr>
591 <tr>
592 <td width="586"><font face="Courier New">
593void <b>insert</b>(const polygon_45_set_data&amp; polygon_set, <br />
594&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool
595is_hole = false)</font></td>
596 <td>Insert a polygon set.&nbsp; Linear wrt the number of
597vertices added.</td>
598 </tr>
599 <tr>
600 <td width="586"><font face="Courier New">
601template &lt;typename geometry_type&gt;<br />
602void <b>insert</b>(const geometry_type&amp; geometry_object, <br />
603&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bool
604is_hole = false)</font></td>
605 <td>Insert a geometry object, if is_hole is true then the
606inserted region is subtractive rather than additive.&nbsp; Linear wrt
607the number of vertices added.</td>
608 </tr>
609 <tr>
610 <td width="586"><font face="Courier New">template
611&lt;typename output_container&gt;<br />
612void <b>get</b>(output_container&amp; output) const</font></td>
613 <td>Expects a standard container of geometry objects.&nbsp;
614Will scan and eliminate overlaps.&nbsp; Converts polygon set geometry
615to objects of that type and appends them to the container.&nbsp;
616Polygons will be output with counterclockwise winding, hole polygons
617will be output with clockwise winding.&nbsp; The last vertex of an
618output polygon is not the duplicate of the first, and the number of
619points is equal to the number of edges.&nbsp; O(n log n) runtime and
620O(n) memory wrt. vertices + intersections.</td>
621 </tr>
622 <tr>
623 <td width="586"><font face="Courier New">template
624&lt;typename output_container&gt;<br />
625void <b>get_polygons</b>(output_container&amp; output) const</font></td>
626 <td>Expects a standard container of polygon objects.&nbsp;
627Will scan and eliminate overlaps.&nbsp; Converts polygon set geometry
628to polygons and appends them to the container.&nbsp; Polygons will have
629holes fractured out to the outer boundary along the positive y
630direction.&nbsp; O(n log n) runtime and O(n) memory wrt. vertices +
631intersections.</td>
632 </tr>
633 <tr>
634 <td width="586"><font face="Courier New">template
635&lt;typename output_container&gt;<br />
636void <b>get_polygons_with_holes</b>(output_container&amp; o) const</font></td>
637 <td>Expects a standard container of polygon with holes
638objects.&nbsp; Will scan and eliminate overlaps.&nbsp; Converts polygon
639set geometry to polygons and appends them to the container.&nbsp; O(n
640log n) runtime and O(n) memory wrt. vertices + intersections.</td>
641 </tr>
642 <tr>
643 <td width="586"><font face="Courier New">template
644&lt;typename output_container&gt;<br />
645void <b>get_trapezoids</b>(output_container&amp; output) const</font></td>
646 <td>Expects a standard container of polygon objects.&nbsp;
647Will scan and eliminate overlaps.&nbsp; Slices polygon set geometry to
648trapezoids vertically and appends them to the container.&nbsp; O(n log
649n) runtime and O(n) memory wrt. vertices + intersections.</td>
650 </tr>
651 <tr>
652 <td width="586"><font face="Courier New">
653template &lt;typename output_container&gt;<br />
654void <b>get_trapezoids</b>(output_container&amp; output, <br />
655&nbsp; orientation_2d slicing_orientation) const </font> </td>
656 <td>Expects a standard container of polygon objects.&nbsp;
657Will scan and eliminate overlaps.&nbsp; Slices polygon set geometry to
658trapezoids along the given orientation and appends them to the
659container.&nbsp; O(n log n) runtime and O(n) memory wrt. vertices +
660intersections.</td>
661 </tr>
662 <tr>
663 <td width="586"><font face="Courier New">
664bool <b>operator==</b>(const polygon_45_set_data&amp; p) const</font></td>
665 <td>Once scanned the data representation of geometry within
666a polygon set is in a mathematically canonical form.&nbsp; Comparison
667between two sets is therefore a linear time operation once they are in
668the scanned state. Will scan and eliminate overlaps in both polygon
669sets.&nbsp; O(n log n) runtime and O(n) memory wrt. vertices +
670intersections the first time and linear runtime and constant memory
671subsequently.&nbsp; </td>
672 </tr>
673 <tr>
674 <td width="586"><font face="Courier New">bool <b>operator!=</b>(const
675polygon_45_set_data&amp; p) const</font></td>
676 <td>Inverse logic of equivalence operator.</td>
677 </tr>
678 <tr>
679 <td width="586"><font face="Courier New">void <b>clear</b>()</font></td>
680 <td>Make the polygon set empty.&nbsp; Note: does not
681de-allocate memory.&nbsp; Use shrink to fit idiom and assign default
682constructed polygon set to de-allocate.</td>
683 </tr>
684 <tr>
685 <td width="586"><font face="Courier New">bool <b>empty</b>()
686const </font> </td>
687 <td>Check whether the polygon set contains no
688geometry.&nbsp; Will scan and eliminate overlaps because subtractive
689regions might make the polygon set empty.&nbsp; O(n log n) runtime and
690O(n) memory wrt. vertices + intersections the first time and linear
691runtime and constant memory subsequently.&nbsp; </td>
692 </tr>
693 <tr>
694 <td width="586"><font face="Courier New">bool <b>is_manhattan</b>()
695const</font></td>
696 <td>Returns in constant time the information about whether
697the geometry contains only Manhattan (axis-parallel rectilinear)
698edges.&nbsp; Constant time.</td>
699 </tr>
700 <tr>
701 <td width="586"><font face="Courier New">void <b>clean</b>()
702const</font></td>
703 <td>Scan and eliminate overlaps.&nbsp; O(n log n) runtime
704and O(n) memory wrt. vertices + intersections the first time and linear
705runtime and constant memory subsequently.&nbsp; </td>
706 </tr>
707 <tr>
708 <td width="586"><font face="Courier New">template
709&lt;typename input_iterator_type&gt;<br />
710void <b>set</b>(input_iterator_type input_begin, <br />
711&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input_iterator_type
712input_end) </font> </td>
713 <td>Overwrite geometry in polygon set with insertable
714objects in the iterator range.&nbsp; </td>
715 </tr>
716 <tr>
717 <td width="586"><font face="Courier New">template
718&lt;typename rectangle_type&gt;<br />
719bool <b>extents</b>(rectangle_type&amp; extents_rectangle) const</font></td>
720 <td>Given an object that models rectangle, scans and
721eliminates overlaps in the polygon set because subtractive regions may
722alter its extents then computes the bounding box and assigns it to
723extents_rectangle.&nbsp; O(n log n) runtime and O(n) memory wrt.
724vertices the first time and linear runtime and constant memory
725subsequently.&nbsp; </td>
726 </tr>
727 <tr>
728 <td width="586"><font face="Courier New">polygon_45_set_data&amp;<br />
729 <b>resize</b>(coord_type resizing,<br />
730&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RoundingOption rounding = CLOSEST,
731 <br />
732&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CornerOption corner = INTERSECTION)</font></td>
733 <td>Same as bloat if resizing is positive, same as shrink
734if resizing is negative.&nbsp; RoundingOption is an enum that controls
735snapping of non-integer results of resizing 45 degree edges.&nbsp;
736CornerOption is an enum that controls how corner filling is
737performed.&nbsp; polygon_45_set_data.hpp defines these enums.&nbsp; O(n
738log n) runtime and O(n) memory wrt. vertices + intersections.</td>
739 </tr>
740 <tr>
741 <td width="586"><font face="Courier New">template
742&lt;typename transformation_type&gt;<br />
743polygon_45_set_data&amp; <br />
744 <b>transform</b>(const transformation_type&amp;
745transformation) </font> </td>
746 <td>Applies transformation.transform() on vertices stored
747within the polygon set.&nbsp; O(n log n) runtime and O(n) memory wrt.
748vertices + intersections.</td>
749 </tr>
750 <tr>
751 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
752 <b>scale_up</b>(unsigned_area_type factor)</font></td>
753 <td>Scales vertices stored within the polygon set up by
754factor.&nbsp; Linear wrt vertices.</td>
755 </tr>
756 <tr>
757 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
758 <b>scale_down</b>(unsigned_area_type factor)</font>&nbsp;</td>
759 <td>Scales vertices stored within the polygon set down by
760factor.&nbsp; Linear wrt vertices.</td>
761 </tr>
762 <tr>
763 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
764 <b>scale</b>(double factor) </font></td>
765 <td>Scales vertices stored within the polygon set by
766floating point factor.&nbsp; Linear wrt vertices.</td>
767 </tr>
768 <tr>
769 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
770 <b>self_xor</b>()</font></td>
771 <td>Retain only non-overlapping regions of geometry within
772polygon set.&nbsp; O(n log n) runtime and O(n) memory wrt. vertices +
773intersections.</td>
774 </tr>
775 <tr>
776 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
777 <b>self_intersect</b>()</font></td>
778 <td>Retain only overlapping regions of geometry within a
779polygon set.&nbsp; O(n log n) runtime and O(n) memory wrt. vertices +
780intersections.</td>
781 </tr>
782 <tr>
783 <td width="586"><font face="Courier New">bool <b>has_error_data</b>()
784const </font></td>
785 <td>Returns true if non-integer intersections resulted in
786small artifacts in the output of a boolean.&nbsp; Constant time.</td>
787 </tr>
788 <tr>
789 <td width="586"><font face="Courier New">std::size_t <b>error_count</b>()
790const</font></td>
791 <td>Returns the number of artifacts that may potentially be
792present in the output due to non-integer intersections.&nbsp; Constant
793time.</td>
794 </tr>
795 <tr>
796 <td width="586"><font face="Courier New">void <b>get_error_data</b>(polygon_45_set_data&amp;
797p) const</font></td>
798 <td>Populates the input polygon set with 1x1 unit squares
799that bound the error that may be present in the output due to
800non-integer intersections.&nbsp; Linear wrt. vertices of error data.</td>
801 </tr>
802 <tr>
803 <td width="586"><font face="Courier New">polygon_45_set_data&amp;
804 <b>self_intersect</b>()</font></td>
805 <td>Retain only overlapping regions of geometry within a
806polygon set.&nbsp; O(n log n) runtime and O(n) memory wrt. vertices +
807intersections.</td>
808 </tr>
809 </tbody>
810 </table>
811 </td>
812 </tr>
813 <tr>
814 <td style="background-color: rgb(238, 238, 238);" nowrap="1"
815 valign="top"> &nbsp;</td>
816 <td
817 style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
818 valign="top" width="100%">
819 <table class="docinfo" id="table6" frame="void" rules="none">
820 <colgroup> <col class="docinfo-name" /><col
821 class="docinfo-content" /> </colgroup> <tbody valign="top">
822 <tr>
823 <th class="docinfo-name">Copyright:</th>
824