]>
Commit | Line | Data |
---|---|---|
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: Isotropy</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>Isotropy</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 | |
39 | With 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 | |
42 | With 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 | |
45 | Holes Concept</a></li> | |
46 | <li><a href="gtl_polygon_90_set_concept.htm">Polygon 90 Set | |
47 | Concept</a></li> | |
48 | <li><a href="gtl_polygon_45_set_concept.htm">Polygon 45 Set | |
49 | Concept</a></li> | |
50 | <li><a href="gtl_polygon_set_concept.htm">Polygon Set Concept</a></li> | |
51 | <li><a href="gtl_connectivity_extraction_90.htm">Connectivity | |
52 | Extraction 90</a></li> | |
53 | <li><a href="gtl_connectivity_extraction_45.htm">Connectivity | |
54 | Extraction 45</a></li> | |
55 | <li><a href="gtl_connectivity_extraction.htm">Connectivity | |
56 | Extraction</a></li> | |
57 | <li><a href="gtl_property_merge_90.htm">Property Merge 90</a></li> | |
58 | <li><a href="gtl_property_merge_45.htm">Property Merge 45</a></li> | |
59 | <li><a href="gtl_property_merge.htm">Property Merge</a></li> | |
60 | <li><a href="voronoi_main.htm">Voronoi Main Page<br /> | |
61 | </a></li> | |
62 | <li><a href="voronoi_benchmark.htm">Voronoi Benchmark</a><br /> | |
63 | </li> | |
64 | <li><a href="voronoi_builder.htm">Voronoi Builder</a></li> | |
65 | <li><a href="voronoi_diagram.htm">Voronoi Diagram</a></li> | |
66 | </ul> | |
67 | <h3 class="navbar">Other Resources</h3> | |
68 | <ul> | |
69 | <li><a href="GTL_boostcon2009.pdf">GTL Boostcon 2009 Paper</a></li> | |
70 | <li><a href="GTL_boostcon_draft03.pdf">GTL Boostcon 2009 | |
71 | Presentation</a></li> | |
72 | <li><a href="analysis.htm">Performance Analysis</a></li> | |
73 | <li><a href="gtl_tutorial.htm">Layout Versus Schematic Tutorial</a></li> | |
74 | <li><a href="gtl_minkowski_tutorial.htm">Minkowski Sum Tutorial</a></li> | |
75 | <li><a href="voronoi_basic_tutorial.htm">Voronoi Basic Tutorial</a></li> | |
76 | <li><a href="voronoi_advanced_tutorial.htm">Voronoi Advanced | |
77 | Tutorial</a></li> | |
78 | </ul> | |
79 | </div> | |
80 | <h3 class="navbar">Polygon Sponsor</h3> | |
81 | <div style="padding: 5px;" align="center"> <img | |
82 | src="images/intlogo.gif" border="0" height="51" width="127" /><a | |
83 | title="www.adobe.com home page" href="http://www.adobe.com/" | |
84 | tabindex="2" style="border: medium none ;"> </a> </div> | |
85 | </td> | |
86 | <td | |
87 | style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;" | |
88 | valign="top" width="100%"> | |
89 | <!-- End Header --><br /> | |
90 | <p> | |
91 | </p> | |
92 | <h1>Isotropy</h1> | |
93 | <p> </p> | |
94 | <p align="left">What is isotropy?</p> | |
95 | <p:colorscheme | |
96 | colors="#ffffff,#000000,#808080,#000000,#bbe0e3,#333399,#009999,#99cc00"> | |
97 | </p:colorscheme> | |
98 | <div class="O" style="text-align: center;" v:shape="_x0000_s1026"> | |
99 | <p style="text-align: left;"> <span style="">Isotropy - | |
100 | Function: <i>adjective</i> Etymology: International Scientific | |
101 | Vocabulary<br /> | |
102 | <b>:</b> exhibiting properties (as velocity of light | |
103 | transmission) with the same values when measured along axes in all | |
104 | directions <an <i>isotropic</i> crystal></span></p> | |
105 | </div> | |
106 | <p align="left">In computational geometry things are often | |
107 | symmetric and invariant to direction and orientation. This | |
108 | invariance to direction is called isotropy. In such situations it | |
109 | is convenient to parameterize direction or orientation and write code | |
110 | that is invariant to the direction or orientation in which it is | |
111 | applied. To do this effectively we provide an internally | |
112 | consistent set of isotropic data types to represent program data that | |
113 | describes orientations and directions. These data types are:</p> | |
114 | <ul> | |
115 | <li>direction_1d - has one of the following 2 states: LOW, HIGH | |
116 | </li> | |
117 | <li>orientation_2d - has one of the following 2 states: | |
118 | HORIZONTAL, VERTICAL</li> | |
119 | <li>direction_2d - has one of the following 4 states: WEST, | |
120 | EAST, SOUTH, NORTH</li> | |
121 | <li>orientation_3d - has one of the following 3 states: | |
122 | HORIZONTAL, VERTICAL, PROXIMAL</li> | |
123 | <li>direction_3d - has one of the following 6 states: WEST, | |
124 | EAST, SOUTH, NORTH, DOWN, UP</li> | |
125 | </ul> | |
126 | <p align="left">The isotropic types create a system and interact | |
127 | with each other in various ways, such as casting. Together they | |
128 | create a language for describing isotropic situations | |
129 | programmatically. For instance, to get the positive direction_2d | |
130 | from an orientation_2d you would call a member function of | |
131 | orientation_2d and pass a direction_1d:</p> | |
132 | <p align="left"><font face="Courier New">orientation_2d orient = | |
133 | HORIZONTAL;<br /> | |
134 | direction_2d dir = orient.get_direction(direction_1d(HIGH));<br /> | |
135 | assert(dir == EAST);</font></p> | |
136 | <p align="left">The motivation for providing isotropic data types | |
137 | is to encourage programming at a higher level of abstraction where | |
138 | program behavior is controlled by program data passed into function | |
139 | calls rather than flow control syntax. Isotropic programming | |
140 | style is particularly applicable to working with points, intervals and | |
141 | rectangles. Often times the implementation of such logic is | |
142 | identical when implemented for the x or y coordinates, except that the | |
143 | names of functions and data members are changed in a mechanical way | |
144 | leading to code duplication and bloat that results in copy-paste | |
145 | programming errors and maintenance problems where changes made to a | |
146 | given code block relating to x coordiantes are not duplicated to the | |
147 | code block that refers to y. Isotropy therefore represents an | |
148 | opportunity to refactor and improve the quality of low level geometry | |
149 | code especially in regard to inter-relating coordinates, points, | |
150 | intervals and rectangles.</p> | |
151 | <h2>direction_1d</h2> | |
152 | <p> </p> | |
153 | <p align="left">The direction_1d data type has two possible | |
154 | states. These are the positive and negative directions on a | |
155 | continuum such as the number line. These states can be | |
156 | described by one of several direction_1d_enum values: We make | |
157 | clockwise and counterclockwise winding orientation of polygons a | |
158 | direction 1d value instead of providing a separate winding_orientation | |
159 | data type. This is because winding orientation can be thought of | |
160 | as positive and negative directions in a 1d (although cyclic) | |
161 | space. We assign counterclockwise to be the positive direction of | |
162 | travel in the 1d cyclic space to conform with the mathematical | |
163 | convention frequently described as the "right hand rule" which assigns | |
164 | positive normal value to counterclockwise and negative normal value to | |
165 | clockwise as well as the common convention that counterclockwise | |
166 | polygon winding corresponds to positive polygonal regions where as | |
167 | clockwise polygon winding corresponds to hole (negative) polygonal | |
168 | regions.</p> | |
169 | <p align="left"><font face="Courier New">enum direction_1d_enum | |
170 | {LOW = 0, HIGH = 1,<br /> | |
171 | | |
172 | LEFT = 0, RIGHT = 1,<br /> | |
173 | | |
174 | CLOCKWISE = 0, COUNTERCLOCKWISE = 1,<br /> | |
175 | | |
176 | REVERSE = 0, FORWARD = 1,<br /> | |
177 | | |
178 | NEGATIVE = 0, POSITIVE = 1 };</font></p> | |
179 | <h2>Member Functions</h2> | |
180 | <table id="table1" border="1" width="100%"> | |
181 | <tbody> | |
182 | <tr> | |
183 | <td width="586"><font face="Courier New"><b>direction_1d</b>(direction_1d_enum | |
184 | val = LOW)</font></td> | |
185 | <td>Constructor defaults to LOW. </td> | |
186 | </tr> | |
187 | <tr> | |
188 | <td width="586"><b><font face="Courier New">direction_1d</font></b><font | |
189 | face="Courier New">(const direction_1d& that)</font></td> | |
190 | <td>Copy construct.</td> | |
191 | </tr> | |
192 | <tr> | |
193 | <td width="586"><b><font face="Courier New">direction_1d</font></b><font | |
194 | face="Courier New">(const direction_2d& that)</font></td> | |
195 | <td>Down cast direction_2d, extracting out whether positive | |
196 | or negative</td> | |
197 | </tr> | |
198 | <tr> | |
199 | <td width="586"><b><font face="Courier New">direction_1d</font></b><font | |
200 | face="Courier New">(const direction_3d& that)</font></td> | |
201 | <td>Down cast direction_3d, extracting out whether positive | |
202 | or negative</td> | |
203 | </tr> | |
204 | <tr> | |
205 | <td width="586"><font face="Courier New">direction_1d& <b>operator=</b>(const | |
206 | direction_1d dir)</font></td> | |
207 | <td>Assignment</td> | |
208 | </tr> | |
209 | <tr> | |
210 | <td width="586"><font face="Courier New">direction_1d& <b>operator==</b>(const | |
211 | direction_1d dir) const</font></td> | |
212 | <td>Equivalence</td> | |
213 | </tr> | |
214 | <tr> | |
215 | <td width="586"><font face="Courier New">direction_1d& <b>operator!=</b>(const | |
216 | direction_1d dir) const</font></td> | |
217 | <td>Inequivalence</td> | |
218 | </tr> | |
219 | <tr> | |
220 | <td width="586"><font face="Courier New">unsigned int <b>to_int</b>() | |
221 | const</font></td> | |
222 | <td>Convert to the integer enum value of current state to | |
223 | use as index. Auto-cast to int is disallowed for type safety | |
224 | reasons.</td> | |
225 | </tr> | |
226 | <tr> | |
227 | <td width="586"><font face="Courier New">direction_1d& <b>backward</b>()</font></td> | |
228 | <td>Inverts direction.</td> | |
229 | </tr> | |
230 | <tr> | |
231 | <td width="586"><font face="Courier New">int <b>get_sign</b>() | |
232 | const</font></td> | |
233 | <td>Returns positive 1 if positive direction and negative | |
234 | one if negative direction.</td> | |
235 | </tr> | |
236 | </tbody> | |
237 | </table> | |
238 | <h2>orientation_2d</h2> | |
239 | <p> </p> | |
240 | <p align="left">The orientation_2d data type has two possible | |
241 | states. These are the horizontal and vertical axis of a 2d | |
242 | Cartesian coordinate system. These states can be described | |
243 | by one of the two orientation_2d_enum values:</p> | |
244 | <p align="left"><font face="Courier New">enum orientation_2d_enum | |
245 | { HORIZONTAL = 0, VERTICAL = 1 };</font></p> | |
246 | <h2>Member Functions</h2> | |
247 | <table id="table2" border="1" width="100%"> | |
248 | <tbody> | |
249 | <tr> | |
250 | <td width="586"><b><font face="Courier New">orientation_2</font></b><font | |
251 | face="Courier New"><b>d</b>(orientation_2d_enum val = HORIZONTAL)</font></td> | |
252 | <td>Constructor defaults to HORIZONTAL. </td> | |
253 | </tr> | |
254 | <tr> | |
255 | <td width="586"><b><font face="Courier New">orientation_2</font></b><font | |
256 | face="Courier New"><b>d</b>(const orientation_2d& that)</font></td> | |
257 | <td>Copy construct.</td> | |
258 | </tr> | |
259 | <tr> | |
260 | <td width="586"><font face="Courier New">explicit </font><b> | |
261 | <font face="Courier New">orientation_2</font></b><font | |
262 | face="Courier New"><b>d</b>(const direction_2d& that)</font></td> | |
263 | <td>Down cast direction_2d, extracting out whether | |
264 | horizontal or vertical direction type</td> | |
265 | </tr> | |
266 | <tr> | |
267 | <td width="586"><font face="Courier New">orientation_2d& | |
268 | <b>operator=</b>(const orientation_2d o)</font></td> | |
269 | <td>Assignment</td> | |
270 | </tr> | |
271 | <tr> | |
272 | <td width="586"><font face="Courier New">orientation_2d& | |
273 | <b>operator==</b>(const orientation_2d o) const</font></td> | |
274 | <td>Equivalence</td> | |
275 | </tr> | |
276 | <tr> | |
277 | <td width="586"><font face="Courier New">orientation_2d& | |
278 | <b>operator!=</b>(const orientation_2d o) const</font></td> | |
279 | <td>Inequivalence</td> | |
280 | </tr> | |
281 | <tr> | |
282 | <td width="586"><font face="Courier New">unsigned int <b>to_int</b>() | |
283 | const</font></td> | |
284 | <td>Convert to the integer enum value of current state to | |
285 | use as index. Auto-cast to int is disallowed for type safety | |
286 | reasons</td> | |
287 | </tr> | |
288 | <tr> | |
289 | <td width="586"><font face="Courier New">orientation_2d& | |
290 | <b>turn_90</b>()</font></td> | |
291 | <td>Change to orthogonal orientation</td> | |
292 | </tr> | |
293 | <tr> | |
294 | <td width="586"><font face="Courier New">int <b>get_perpendicular</b>() | |
295 | const</font></td> | |
296 | <td>Returns orthogonal orientation</td> | |
297 | </tr> | |
298 | <tr> | |
299 | <td width="586"><font face="Courier New">int <b>get_direction</b>(direction_1d | |
300 | dir) const</font></td> | |
301 | <td>Returns the positive or negative direction_2d depending | |
302 | on the value of dir</td> | |
303 | </tr> | |
304 | </tbody> | |
305 | </table> | |
306 | <h2>direction_2d</h2> | |
307 | <p> </p> | |
308 | <p align="left">The direction_2d data type has four possible | |
309 | states. These are the cardinal directions of the 2D Cartesian | |
310 | coordinate system. These states can be described by one of | |
311 | several direction_2d_enum values:</p> | |
312 | <p align="left"><font face="Courier New">enum direction_2d_enum { | |
313 | WEST = 0, EAST = 1, SOUTH = 2, NORTH = 3 };</font></p> | |
314 | <h2>Member Functions</h2> | |
315 | <table id="table3" border="1" width="100%"> | |
316 | <tbody> | |
317 | <tr> | |
318 | <td width="586"><font face="Courier New"><b>direction_2d</b>(direction_2d_enum | |
319 | val = WEST)</font></td> | |
320 | <td>Constructor defaults to WEST. </td> | |
321 | </tr> | |
322 | <tr> | |
323 | <td width="586"><b><font face="Courier New">direction_2d</font></b><font | |
324 | face="Courier New">(const direction_2d& that)</font></td> | |
325 | <td>Copy construct.</td> | |
326 | </tr> | |
327 | <tr> | |
328 | <td width="586"><font face="Courier New">direction_1d& <b>operator=</b>(const | |
329 | direction_2d dir)</font></td> | |
330 | <td>Assignment</td> | |
331 | </tr> | |
332 | <tr> | |
333 | <td width="586"><font face="Courier New">direction_1d& <b>operator==</b>(const | |
334 | direction_2d dir) const</font></td> | |
335 | <td>Equivalence</td> | |
336 | </tr> | |
337 | <tr> | |
338 | <td width="586"><font face="Courier New">direction_1d& <b>operator!=</b>(const | |
339 | direction_2d dir) const</font></td> | |
340 | <td>Inequivalence</td> | |
341 | </tr> | |
342 | <tr> | |
343 | <td width="586"><font face="Courier New">unsigned int <b>to_int</b>() | |
344 | const</font></td> | |
345 | <td>Convert to the integer enum value of current state to | |
346 | use as index. Auto-cast to int is disallowed for type safety | |
347 | reasons.</td> | |
348 | </tr> | |
349 | <tr> | |
350 | <td width="586"><font face="Courier New">direction_2d& <b>backward</b>()</font></td> | |
351 | <td>Inverts direction.</td> | |
352 | </tr> | |
353 | <tr> | |
354 | <td width="586"><font face="Courier New">direction_2d& <b>turn</b>(direction_1d | |
355 | dir)</font></td> | |
356 | <td>Changes to direction_2d to the left if dir is LOW, to | |
357 | the right if dir is HIGH</td> | |
358 | </tr> | |
359 | <tr> | |
360 | <td width="586"><font face="Courier New">direction_2d& <b>left</b>()</font></td> | |
361 | <td>Changes to the direction_2d to the left</td> | |
362 | </tr> | |
363 | <tr> | |
364 | <td width="586"><font face="Courier New">direction_2d& <b>right</b>()</font></td> | |
365 | <td>Changes to the direction_2d to the right</td> | |
366 | </tr> | |
367 | <tr> | |
368 | <td width="586"><font face="Courier New">int <b>is_positive</b>() | |
369 | const</font></td> | |
370 | <td>Returns true if EAST or NORTH</td> | |
371 | </tr> | |
372 | <tr> | |
373 | <td width="586"><font face="Courier New">int <b>is_negative</b>() | |
374 | const</font></td> | |
375 | <td>Returns true if WEST or SOUTH</td> | |
376 | </tr> | |
377 | <tr> | |
378 | <td width="586"><font face="Courier New">int <b>get_sign</b>() | |
379 | const</font></td> | |
380 | <td>Returns positive 1 if positive direction and negative | |
381 | one if negative direction.</td> | |
382 | </tr> | |
383 | </tbody> | |
384 | </table> | |
385 | <h2>orientation_3d</h2> | |
386 | <p> </p> | |
387 | <p align="left">The orientation_3d data type has three possible | |
388 | states. These are the horizontal, vertical and proximal (x, y, z) | |
389 | axis of a 3d Cartesian coordinate system. These states can | |
390 | be described by one of the orientation_2d_enum values or by the | |
391 | orientation_3d_enum value:</p> | |
392 | <p align="left"><font face="Courier New">enum orientation_3d_enum | |
393 | { PROXIMAL = 2 };</font></p> | |
394 | <h2>Member Functions</h2> | |
395 | <table id="table6" border="1" width="100%"> | |
396 | <tbody> | |
397 | <tr> | |
398 | <td width="586"><b><font face="Courier New">orientation_3</font></b><font | |
399 | face="Courier New"><b>d</b>(orientation_2d_enum val = HORIZONTAL)</font></td> | |
400 | <td>Constructor defaults to HORIZONTAL. </td> | |
401 | </tr> | |
402 | <tr> | |
403 | <td width="586"><b><font face="Courier New">orientation_3</font></b><font | |
404 | face="Courier New"><b>d</b>(const orientation_3d& that)</font></td> | |
405 | <td>Copy construct.</td> | |
406 | </tr> | |
407 | <tr> | |
408 | <td width="586"><font face="Courier New">explicit </font><b> | |
409 | <font face="Courier New">orientation_3</font></b><font | |
410 | face="Courier New"><b>d</b>(const direction_2d& that)</font></td> | |
411 | <td>Extract out the orientation of the direction</td> | |
412 | </tr> | |
413 | <tr> | |
414 | <td width="586"><font face="Courier New">explicit </font><b> | |
415 | <font face="Courier New">orientation_3</font></b><font | |
416 | face="Courier New"><b>d</b>(const direction_3d& that)</font></td> | |
417 | <td>Extract out the orientation of the direction</td> | |
418 | </tr> | |
419 | <tr> | |
420 | <td width="586"><b><font face="Courier New">orientation_3</font></b><font | |
421 | face="Courier New"><b>d</b>(const orientation_2d& that)</font></td> | |
422 | <td>Up cast orientation_2d to orientation_3d.</td> | |
423 | </tr> | |
424 | <tr> | |
425 | <td width="586"><b><font face="Courier New">orientation_3</font></b><font | |
426 | face="Courier New"><b>d</b>(const orientation_3d_enum& that)</font></td> | |
427 | <td>Construct from constant value</td> | |
428 | </tr> | |
429 | <tr> | |
430 | <td width="586"><font face="Courier New">orientation_3d& | |
431 | <b>operator=</b>(const orientation_3d o)</font></td> | |
432 | <td>Assignment</td> | |
433 | </tr> | |
434 | <tr> | |
435 | <td width="586"><font face="Courier New">orientation_3d& | |
436 | <b>operator==</b>(const orientation_3d o) const</font></td> | |
437 | <td>Equivalence</td> | |
438 | </tr> | |
439 | <tr> | |
440 | <td width="586"><font face="Courier New">orientation_3d& | |
441 | <b>operator!=</b>(const orientation_3d o) const</font></td> | |
442 | <td>Inequivalence</td> | |
443 | </tr> | |
444 | <tr> | |
445 | <td width="586"><font face="Courier New">unsigned int <b>to_int</b>() | |
446 | const</font></td> | |
447 | <td>Convert to the integer enum value of current state to | |
448 | use as index. Auto-cast to int is disallowed for type safety | |
449 | reasons</td> | |
450 | </tr> | |
451 | <tr> | |
452 | <td width="586"><font face="Courier New">int <b>get_direction</b>(direction_1d | |
453 | dir) const</font></td> | |
454 | <td>Returns the positive or negative direction_2d depending | |
455 | on the value of dir</td> | |
456 | </tr> | |
457 | </tbody> | |
458 | </table> | |
459 | <h2>direction_3d</h2> | |
460 | <p> </p> | |
461 | <p align="left">The direction_3d data type has six possible | |
462 | states. These are the cardinal directions of the 3D Cartesian | |
463 | coordinate system. These states can be described by one of | |
464 | the direction_2d_enum values or the direction_3d_enum values:</p> | |
465 | <p align="left"><font face="Courier New">enum direction_3d_enum { | |
466 | DOWN = 4, UP = 5 };</font></p> | |
467 | <h2>Member Functions</h2> | |
468 | <table id="table5" border="1" width="100%"> | |
469 | <tbody> | |
470 | <tr> | |
471 | <td width="586"><font face="Courier New"><b>direction_3d</b>(direction_2d_enum | |
472 | val = WEST)</font></td> | |
473 | <td>Constructor defaults to LOW. </td> | |
474 | </tr> | |
475 | <tr> | |
476 | <td width="586"><b><font face="Courier New">direction_3d</font></b><font | |
477 | face="Courier New">(direction_3d_enum that)</font></td> | |
478 | <td>Construct from constant value</td> | |
479 | </tr> | |
480 | <tr> | |
481 | <td width="586"><b><font face="Courier New">direction_3d</font></b><font | |
482 | face="Courier New">(const direction_3d& that)</font></td> | |
483 | <td>Copy construct</td> | |
484 | </tr> | |
485 | <tr> | |
486 | <td width="586"><b><font face="Courier New">direction_3d</font></b><font | |
487 | face="Courier New">(direction_2d that)</font></td> | |
488 | <td>Up cast direction_2d to direction_3d</td> | |
489 | </tr> | |
490 | <tr> | |
491 | <td width="586"><font face="Courier New">direction_3d& <b>operator=</b>(const | |
492 | direction_3d dir)</font></td> | |
493 | <td>Assignment</td> | |
494 | </tr> | |
495 | <tr> | |
496 | <td width="586"><font face="Courier New">direction_3d& <b>operator==</b>(const | |
497 | direction_3d dir) const</font></td> | |
498 | <td>Equivalence</td> | |
499 | </tr> | |
500 | <tr> | |
501 | <td width="586"><font face="Courier New">direction_2d& <b>operator!=</b>(const | |
502 | direction_3d dir) const</font></td> | |
503 | <td>Inequivalence</td> | |
504 | </tr> | |
505 | <tr> | |
506 | <td width="586"><font face="Courier New">unsigned int <b>to_int</b>() | |
507 | const</font></td> | |
508 | <td>Convert to the integer enum value of current state to | |
509 | use as index. Auto-cast to int is disallowed for type safety | |
510 | reasons.</td> | |
511 | </tr> | |
512 | <tr> | |
513 | <td width="586"><font face="Courier New">direction_1d& <b>backward</b>()</font></td> | |
514 | <td>Inverts direction.</td> | |
515 | </tr> | |
516 | <tr> | |
517 | <td width="586"><font face="Courier New">int <b>is_positive</b>() | |
518 | const</font></td> | |
519 | <td>Returns true if direction is EAST, NORTH or UP.</td> | |
520 | </tr> | |
521 | <tr> | |
522 | <td width="586"><font face="Courier New">int <b>is_negative</b>() | |
523 | const</font></td> | |
524 | <td>Returns true if direction is WEST, SOUTH or DOWN</td> | |
525 | </tr> | |
526 | <tr> | |
527 | <td width="586"><font face="Courier New">int <b>get_sign</b>() | |
528 | const</font></td> | |
529 | <td>Returns positive 1 if positive direction and negative | |
530 | one if negative direction.</td> | |
531 | </tr> | |
532 | </tbody> | |
533 | </table> | |
534 | </td> | |
535 | </tr> | |
536 | <tr> | |
537 | <td style="background-color: rgb(238, 238, 238);" nowrap="1" | |
538 | valign="top"> </td> | |
539 | <td | |
540 | style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;" | |
541 | valign="top" width="100%"> | |
542 | <table class="docinfo" id="table7" frame="void" rules="none"> | |
543 | <colgroup> <col class="docinfo-name" /><col | |
544 | class="docinfo-content" /> </colgroup> <tbody valign="top"> | |
545 | <tr> | |
546 | <th class="docinfo-name">Copyright:</th> | |
547 |