gtl_interval_concept.htm 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  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: Interval 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>Interval Concept</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>Interval Concept</h1>
  93. <p> </p>
  94. <p>The interval concept tag is <font face="Courier New">
  95. interval_concept</font></p>
  96. <p> To register a user defined type as a model of interval
  97. concept, specialize the geometry concept meta-function for that
  98. type.&nbsp; In the example below CInterval is registered as a model of
  99. interval&nbsp; concept.</p>
  100. <p> <font face="Courier New">template &lt;&gt;<br />
  101. struct geometry_concept&lt;CInterval&gt; { typedef interval_concept
  102. type; };</font></p>
  103. <p> <font face="Times New Roman">The semantic of an interval is
  104. that it has a low and high coordinate and there is an invariant that
  105. low is less than or equal to high.&nbsp; This invariant is enforced by
  106. the generic library functions that operate on intervals, and is not
  107. expected of the data type itself or the concept mapping of that data
  108. type to the interval concept through its traits.&nbsp; In this way a
  109. std::pair&lt;int, int&gt;, boost::tuple&lt;int, int&gt; or
  110. boost::array&lt;int, 2&gt; could all be made models of interval by
  111. simply providing indirect access to their elements through traits.</font></p>
  112. <p> <font face="Times New Roman">Below is shown the default
  113. interval traits.&nbsp; Specialization of these traits is required for
  114. types that don't conform to the default behavior.</font></p>
  115. <p> <font face="Courier New">template &lt;typename T&gt;<br />
  116. struct interval_traits {<br />
  117. &nbsp; typedef typename T::coordinate_type coordinate_type;<br />
  118. <br />
  119. &nbsp; static inline coordinate_type get(const T&amp; interval,
  120. direction_1d dir) {<br />
  121. &nbsp;&nbsp;&nbsp; return interval.get(dir); <br />
  122. &nbsp; }<br />
  123. };<br />
  124. <br />
  125. template &lt;typename T&gt;<br />
  126. struct interval_mutable_traits {<br />
  127. &nbsp; </font><font face="Courier New">typedef typename
  128. T::coordinate_type coordinate_type;</font><br />
  129. <font face="Courier New"><br />
  130. &nbsp; static inline void set(T&amp; interval, direction_1d dir, </font>
  131. <br />
  132. <font face="Courier New">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  133. typename interval_traits&lt;T&gt;::coordinate_type value) {<br />
  134. &nbsp;&nbsp;&nbsp;
  135. interval.set(dir, value); <br />
  136. &nbsp;
  137. }<br />
  138. &nbsp;
  139. static inline T construct(typename
  140. interval_traits&lt;T&gt;::coordinate_type low_value,
  141. <br />
  142. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  143. typename interval_traits&lt;T&gt;::coordinate_type high_value) {<br />
  144. &nbsp;&nbsp;&nbsp;
  145. return T(low_value, high_value); <br />
  146. &nbsp;
  147. }<br />
  148. };</font></p>
  149. <h2>Functions</h2>
  150. <table id="table1" border="1" width="100%">
  151. <tbody>
  152. <tr>
  153. <td width="586"><font face="Courier New">template
  154. &lt;typename T&gt;<br />
  155. coordinate_type <b>get</b>(const T&amp; interval, direction_1d)</font></td>
  156. <td><font face="Times New Roman">Expects a model of
  157. interval.&nbsp; Returns the low or high coordinate of the interval,
  158. depending on the direction_1d value.</font><font face="Courier New"><br />
  159. &nbsp;</font></td>
  160. </tr>
  161. <tr>
  162. <td width="586"><font face="Courier New">template
  163. &lt;typename T, typename coordinate_type&gt;<br />
  164. void <b>set</b>(T&amp; interval, direction_1d, coordinate_type)</font></td>
  165. <td><font face="Times New Roman">Expects a model of
  166. interval.&nbsp;&nbsp; Sets the low or high coordinate of the interval
  167. to the coordinate, depending on the direction_1d value.&nbsp; If low
  168. would be greater than high after this change then both are set to the
  169. input coordinate value.</font></td>
  170. </tr>
  171. <tr>
  172. <td width="586"><font face="Courier New">template
  173. &lt;typename T&gt;<br />
  174. T <b>construct</b>(coordinate_type low, coordinate_type high)</font></td>
  175. <td>Construct an object that is a model of interval given
  176. low and high coordinate values.</td>
  177. </tr>
  178. <tr>
  179. <td width="586"><font face="Courier New">template
  180. &lt;typename T1, typename T2&gt;<br />
  181. T1&amp; <b>assign</b>(T1&amp; left, const T2&amp; right)</font></td>
  182. <td>Copies data from right object that models interval into
  183. left object that models interval.</td>
  184. </tr>
  185. <tr>
  186. <td width="586"><font face="Courier New">template
  187. &lt;typename T, typename T2&gt;<br />
  188. bool <b>equivalence</b>(const T&amp; interval1, const T2&amp;
  189. interval2)</font></td>
  190. <td>Given two objects that model interval, compares and
  191. returns true if their low and high values are respectively equal to
  192. each other.</td>
  193. </tr>
  194. <tr>
  195. <td width="586"><font face="Courier New">template
  196. &lt;typename T&gt;<br />
  197. bool <b>contains</b>(const T&amp;, coordinate_type, <br />
  198. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  199. bool consider_touch=true)</font></td>
  200. <td>Given an object that models interval and a coordinate,
  201. returns true if the interval contains the coordinate.&nbsp; If the
  202. consider_touch flag is true will return true if the coordinate is equal
  203. to one of the interval ends.</td>
  204. </tr>
  205. <tr>
  206. <td width="586"><font face="Courier New">template
  207. &lt;typename T1, typename T2&gt;<br />
  208. bool <b>contains</b>(const T1&amp; a, const T2&amp; b, <br />
  209. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  210. bool consider_touch = true) </font></td>
  211. <td>Returns true if model of interval a contains both ends
  212. of model of interval b.&nbsp; If the consider_touch flag is true will
  213. consider the end of b contained within a even if it is equal to an end
  214. of a.</td>
  215. </tr>
  216. <tr>
  217. <td width="586"><font face="Courier New">template
  218. &lt;typename interval_type&gt;<br />
  219. coordinate_type <b>low</b>(const interval_type&amp; interval)</font></td>
  220. <td>Returns the low end of an object that models interval.</td>
  221. </tr>
  222. <tr>
  223. <td width="586"><font face="Courier New">template
  224. &lt;typename interval_type&gt;<br />
  225. coordinate_type <b>high</b>(const interval_type&amp; interval)</font></td>
  226. <td>Returns the high end of an object that models interval.</td>
  227. </tr>
  228. <tr>
  229. <td width="586"><font face="Courier New">// get the center
  230. coordinate<br />
  231. template &lt;typename interval_type&gt;<br />
  232. coordinate_type <b>center</b>(const interval_type&amp; interval)</font></td>
  233. <td>Returns the center coordinate of an object that models
  234. interval.</td>
  235. </tr>
  236. <tr>
  237. <td width="586"><font face="Courier New">template
  238. &lt;typename interval_type&gt;<br />
  239. void <b>low</b>(interval_type&amp; interval, coordinate_type )</font></td>
  240. <td>Sets the low end of the object that models interval to
  241. the coordinate value.&nbsp; If the low end would be set to larger than
  242. high end then both are set to the coordinate value.</td>
  243. </tr>
  244. <tr>
  245. <td width="586"><font face="Courier New">template
  246. &lt;typename interval_type&gt;<br />
  247. void <b>high</b>(interval_type&amp; interval, coordinate_type )</font></td>
  248. <td>Sets the high end of the object that models interval to
  249. the coordinate value.&nbsp; If the high end would be set to less than
  250. low end then both are set to the coordinate value.</td>
  251. </tr>
  252. <tr>
  253. <td width="586"><font face="Courier New">template
  254. &lt;typename interval_type&gt;<br />
  255. coordinate_difference <b>delta</b>(const interval_type&amp; interval)</font></td>
  256. <td>Returns the distance from low to high end of an object
  257. that models interval.</td>
  258. </tr>
  259. <tr>
  260. <td width="586"><font face="Courier New">template
  261. &lt;typename interval_type&gt;<br />
  262. interval_type&amp; <b>flip</b>(interval_type&amp; interval,<br />
  263. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  264. coordinate_type axis = 0)</font></td>
  265. <td>Flips an object that models interval about the axis
  266. coordinate.&nbsp; If no axis is provided the interval is flipped across
  267. the the origin.</td>
  268. </tr>
  269. <tr>
  270. <td width="586"><font face="Courier New">template
  271. &lt;typename interval_type&gt;<br />
  272. interval_type&amp; <b>scale_up</b>(interval_type&amp; interval, <br />
  273. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  274. unsigned_area_type factor)</font></td>
  275. <td>Multiplies low and high ends of an object that models
  276. interval by unsigned factor.</td>
  277. </tr>
  278. <tr>
  279. <td width="586"><font face="Courier New">template
  280. &lt;typename interval_type&gt;<br />
  281. interval_type&amp; <b>scale_down</b>(interval_type&amp; interval, <br />
  282. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  283. unsigned_area_type factor)</font></td>
  284. <td>Divides low and high ends of an object that models
  285. interval by unsigned factor.</td>
  286. </tr>
  287. <tr>
  288. <td width="586"><font face="Courier New">template
  289. &lt;typename interval_type&gt;<br />
  290. interval_type&amp; <b>scale</b>(interval_type&amp; interval,<br />
  291. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  292. double factor) </font></td>
  293. <td>Multiplies low and high ends of an object that models
  294. interval by floating point value.</td>
  295. </tr>
  296. <tr>
  297. <td width="586"><font face="Courier New">template
  298. &lt;typename interval_type&gt;<br />
  299. interval_type&amp; <b>move</b>(interval_type&amp; interval,<br />
  300. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  301. coordinate_difference displacement)</font></td>
  302. <td>Adds displacement value to low and high ends of an
  303. object that models interval.</td>
  304. </tr>
  305. <tr>
  306. <td width="586"><font face="Courier New">template
  307. &lt;typename interval_type&gt;<br />
  308. interval_type&amp; <b>convolve</b>(interval_type&amp; interval,<br />
  309. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  310. coordinate_type b)</font></td>
  311. <td>Adds coordinate value to low and high ends of an object
  312. that models interval.</td>
  313. </tr>
  314. <tr>
  315. <td width="586"><font face="Courier New">template
  316. &lt;typename interval_type&gt;<br />
  317. interval_type&amp; <b>deconvolve</b>(interval_type&amp; interval,<br />
  318. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  319. coordinate_type b)</font></td>
  320. <td>Subtracts coordinate value from low and high ends of an
  321. object that models interval.</td>
  322. </tr>
  323. <tr>
  324. <td width="586"><font face="Courier New">template
  325. &lt;typename T1, typename T2&gt;<br />
  326. T1&amp; <b>convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
  327. <td>Adds low end of b to low end of a and adds high end of
  328. b to high end of a.</td>
  329. </tr>
  330. <tr>
  331. <td width="586"><font face="Courier New">template
  332. &lt;typename T1, typename T2&gt;<br />
  333. T1&amp; <b>deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
  334. <td>Subtracts low end of b from low end of a and subtracts
  335. high end of b from high end of a. </td>
  336. </tr>
  337. <tr>
  338. <td width="586"><font face="Courier New">template
  339. &lt;typename T1, typename T2&gt;<br />
  340. T1&amp; <b>reflected_convolve</b>(T1&amp; a, const T2&amp; b)</font></td>
  341. <td>Adds high end of b to low end of a and adds low end of
  342. b to high end of a.</td>
  343. </tr>
  344. <tr>
  345. <td width="586"><font face="Courier New">template
  346. &lt;typename T1, typename T2&gt;<br />
  347. T1&amp; <b>reflected_deconvolve</b>(T1&amp; a, const T2&amp; b)</font></td>
  348. <td>Subtracts high end of b from low end of a and subtracts
  349. low end of b from high end of a.</td>
  350. </tr>
  351. <tr>
  352. <td width="586"><font face="Courier New">template
  353. &lt;typename T&gt;<br />
  354. coordinate_difference <b>euclidean_distance</b>(const T&amp;,<br />
  355. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  356. coordinate_type)</font></td>
  357. <td>Returns the distance from an object that models
  358. interval to a coordinate.&nbsp; Returns zero if the coordinate is equal
  359. to an end of the interval or contained within the interval.</td>
  360. </tr>
  361. <tr>
  362. <td width="586"><font face="Courier New">template
  363. &lt;typename T1, typename T2&gt;<br />
  364. bool <b>intersects</b>(const T1&amp; interval, const T2&amp; b, <br />
  365. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  366. bool consider_touch = true)</font></td>
  367. <td>Returns true if two objects that model interval
  368. overlap.&nbsp; If the consider_touch flag is true touching at the
  369. endpoints is considered overlap.</td>
  370. </tr>
  371. <tr>
  372. <td width="586"><font face="Courier New">template
  373. &lt;typename T1, typename T2&gt;<br />
  374. bool <b>boundaries_intersect</b>(const T1&amp; interval, const T2&amp;
  375. b, <br />
  376. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  377. bool consider_touch = true)</font></td>
  378. <td>Returns true is two objects that model interval
  379. partially overlap such that one end point of each is contained within
  380. the other.&nbsp; If the consider_touch flag is true a coordinate is
  381. considered contained even if it is equal to an end.</td>
  382. </tr>
  383. <tr>
  384. <td width="586"><font face="Courier New">template
  385. &lt;typename T1, typename T2&gt;<br />
  386. bool <b>abuts</b>(const T1&amp; a, const T2&amp; b,<br />
  387. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  388. direction_1d dir) </font></td>
  389. <td>Returns true if interval b abuts but down not overlap
  390. interval a on the end of interval a specified by dir.</td>
  391. </tr>
  392. <tr>
  393. <td width="586"><font face="Courier New">template
  394. &lt;typename T1, typename T2&gt;<br />
  395. bool <b>abuts</b>(const T1&amp; a, const T2&amp; b)</font></td>
  396. <td>Returns true if interval b abuts but down not overlap
  397. interval a.</td>
  398. </tr>
  399. <tr>
  400. <td width="586"><font face="Courier New">template
  401. &lt;typename T1, typename T2&gt;<br />
  402. bool <b>intersect</b>(T1&amp; a, const T2&amp; b,<br />
  403. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  404. bool consider_touch = true) </font></td>
  405. <td>Sets interval a to the intersection of interval a and
  406. interval b and return true.&nbsp; If the two intervals do not intersect
  407. interval a is unchanged and the function returns false.&nbsp; If the
  408. flag consider_touch is true intervals that abut are considered to
  409. intersect.</td>
  410. </tr>
  411. <tr>
  412. <td width="586"><font face="Courier New">template
  413. &lt;typename T1, typename T2&gt;<br />
  414. T&amp; <b>generalized_intersect</b>(T1&amp; a, const T2&amp; b)</font></td>
  415. <td>Same as intersect, but if they do not intersect set a
  416. to the interval between a and b.</td>
  417. </tr>
  418. <tr>
  419. <td width="586"><font face="Courier New">template
  420. &lt;typename T&gt;<br />
  421. T&amp; <b>bloat</b>(T&amp; interval, coordinate_type)</font></td>
  422. <td>Adds the coordinate value to high end of interval and
  423. subtracts it from low end of interval.</td>
  424. </tr>
  425. <tr>
  426. <td width="586"><font face="Courier New">template
  427. &lt;typename T&gt;<br />
  428. T&amp; <b>bloat</b>(T&amp; interval, direction_1d, coordinate_type)</font></td>
  429. <td>Adds the coordinate value to high end of interval or
  430. subtracts it from low end of interval depending on the direction_1d.</td>
  431. </tr>
  432. <tr>
  433. <td width="586"><font face="Courier New">template
  434. &lt;typename T&gt;<br />
  435. T&amp; <b>shrink</b>(T&amp; interval, coordinate_type)</font></td>
  436. <td>Subtracts the coordinate value from high end of
  437. interval and adds it to low end of interval.</td>
  438. </tr>
  439. <tr>
  440. <td width="586"><font face="Courier New">template
  441. &lt;typename T&gt;<br />
  442. T&amp; <b>shrink</b>(T&amp; interval, direction_1d, coordinate_type)</font></td>
  443. <td>Subtracts the coordinate value from high end of
  444. interval or adds it to low end of interval depending on the
  445. direction_1d.</td>
  446. </tr>
  447. <tr>
  448. <td width="586"><font face="Courier New">template
  449. &lt;typename T1, typename T2&gt;<br />
  450. bool <b>encompass</b>(T1&amp; a, const T2&amp; b)</font></td>
  451. <td>Sets low of a to min of low of a and low of b and sets
  452. high of a to max of high of a and high of b.&nbsp; Returns true if b
  453. was not contained within a to begin with.</td>
  454. </tr>
  455. <tr>
  456. <td width="586"><font face="Courier New">template
  457. &lt;typename T&gt;<br />
  458. bool <b>encompass</b>(T&amp; a, coordinate_type)</font></td>
  459. <td>Sets low of a to min of low of a and coordinate value
  460. and sets high of a to max of high of a and coordinate value.&nbsp;
  461. Returns true if coordinate value was not contained within a to begin
  462. with.</td>
  463. </tr>
  464. </tbody>
  465. </table>
  466. <h1>Interval Data</h1>
  467. <p> </p>
  468. <p>The library provides a model of interval concept declared
  469. <font face="Courier New">template&lt;typename T&gt; interval_data
  470. </font>where T is the coordinate type.</p>
  471. <p>This data type is used internally when an interval is needed
  472. and is available to the library user who finds it convenient to use a
  473. library interval data type instead of providing their own.&nbsp; The
  474. data type is implemented to be convenient to use with the library
  475. traits.</p>
  476. <h2>Members</h2>
  477. <table id="table2" border="1" width="100%">
  478. <tbody>
  479. <tr>
  480. <td width="586"><b><font face="Courier New">geometry_type</font></b></td>
  481. <td><font face="Times New Roman">interval_concept</font></td>
  482. </tr>
  483. <tr>
  484. <td width="586"><b><font face="Courier New">coordinate_type</font></b></td>
  485. <td><font face="Times New Roman">T</font></td>
  486. </tr>
  487. <tr>
  488. <td width="586"><font face="Courier New"><b>interval_data</b>()</font></td>
  489. <td><font face="Times New Roman">Default constructs the two
  490. coordinate values of the interval.</font></td>
  491. </tr>
  492. <tr>
  493. <td width="586"><font face="Courier New"><b>interval_data</b>(T
  494. low, T high)</font></td>
  495. <td><font face="Times New Roman">Constructs an interval
  496. with two coordinates.</font></td>
  497. </tr>
  498. <tr>
  499. <td width="586"><font face="Courier New"><b>interval_data</b>(const
  500. interval_data&amp; that)</font></td>
  501. <td><font face="Times New Roman">Copy construct</font></td>
  502. </tr>
  503. <tr>
  504. <td width="586"><font face="Courier New">interval_data&amp;
  505. <b>operator=</b>(const interval_data&amp; that)</font></td>
  506. <td>Assignment operator.</td>
  507. </tr>
  508. <tr>
  509. <td width="586"><font face="Courier New">template
  510. &lt;typename IntervalType&gt;<b>&nbsp; <br />
  511. </b>interval_data&amp; <b>operator=</b>(</font><font
  512. face="Courier New">const IntervalType</font><font face="Courier New">&amp;
  513. that) const</font></td>
  514. <td>Assign from an object that is a model of interval.</td>
  515. </tr>
  516. <tr>
  517. <td width="586"><font face="Courier New"><b>bool<b>
  518. operator==</b>(const </b></font><b><font face="Courier New">interval_data</font><font
  519. face="Courier New">&amp; that) const</font></b></td>
  520. <td>Equality operator overload.</td>
  521. </tr>
  522. <tr>
  523. <td width="586"><font face="Courier New">bool<b> operator!=</b>(const
  524. </font><font face="Courier New">interval_data</font><font
  525. face="Courier New">&amp; that) const</font></td>
  526. <td>Inequality operator overload.</td>
  527. </tr>
  528. <tr>
  529. <td width="586"><font face="Courier New">bool<b>
  530. operator&lt;</b>(const </font><font face="Courier New">interval_data</font><font
  531. face="Courier New">&amp; that) const</font></td>
  532. <td>Compares low coordinates then high coordinates to break
  533. ties.</td>
  534. </tr>
  535. <tr>
  536. <td width="586"><font face="Courier New">bool<b>
  537. operator&lt;=</b>(const </font><font face="Courier New">interval_data</font><font
  538. face="Courier New">&amp; that) const</font></td>
  539. <td>Compares low coordinates then high coordinates to break
  540. ties.</td>
  541. </tr>
  542. <tr>
  543. <td width="586"><font face="Courier New">bool<b>
  544. operator&gt;</b>(const </font><font face="Courier New">interval_data</font><font
  545. face="Courier New">&amp; that) const</font></td>
  546. <td>Compares low coordinates then high coordinates to break
  547. ties.</td>
  548. </tr>
  549. <tr>
  550. <td width="586"><font face="Courier New">bool<b>
  551. operator&gt;=</b>(const </font><font face="Courier New">interval_data</font><font
  552. face="Courier New">&amp; that) const</font></td>
  553. <td>Compares low coordinates then high coordinates to break
  554. ties.</td>
  555. </tr>
  556. <tr>
  557. <td width="586"><font face="Courier New">T <b>get</b>(direction_1d
  558. dir) const</font></td>
  559. <td>Get the coordinate in the given direction.</td>
  560. </tr>
  561. <tr>
  562. <td style="vertical-align: top;"><font face="Courier New">T
  563. <span style="font-weight: bold;">low</span>() const</font></td>
  564. <td style="vertical-align: top;">Retrieves the low value.</td>
  565. </tr>
  566. <tr>
  567. <td style="vertical-align: top;"><font face="Courier New">T
  568. <span style="font-weight: bold;">high</span>() const</font></td>
  569. <td style="vertical-align: top;">Retrieves the high
  570. endpoint.</td>
  571. </tr>
  572. <tr>
  573. <td width="586"><font face="Courier New">void <b>set</b>(direction_1d
  574. dir, T value)</font></td>
  575. <td>Sets the coordinate in the given direction to the value.</td>
  576. </tr>
  577. <tr>
  578. <td style="vertical-align: top;"><font face="Courier New">interval_data&amp;
  579. <span style="font-weight: bold;">low</span>(T value)</font></td>
  580. <td style="vertical-align: top;">Sets the low value.</td>
  581. </tr>
  582. <tr>
  583. <td style="vertical-align: top;"><font face="Courier New">interval_data&amp;
  584. <span style="font-weight: bold;">high</span>(T value)</font></td>
  585. <td style="vertical-align: top;">Sets the high value.</td>
  586. </tr>
  587. </tbody>
  588. </table>
  589. </td>
  590. </tr>
  591. <tr>
  592. <td style="background-color: rgb(238, 238, 238);" nowrap="1"
  593. valign="top"> &nbsp;</td>
  594. <td
  595. style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
  596. valign="top" width="100%">
  597. <table class="docinfo" id="table3" frame="void" rules="none">
  598. <colgroup> <col class="docinfo-name" /><col
  599. class="docinfo-content" /> </colgroup> <tbody valign="top">
  600. <tr>
  601. <th class="docinfo-name">Copyright:</th>
  602. <td>Copyright © Intel Corporation 2008-2010.</td>
  603. </tr>
  604. <tr class="field">
  605. <th class="docinfo-name">License:</th>
  606. <td class="field-body">Distributed under the Boost Software
  607. License, Version 1.0. (See accompanying file <tt class="literal"> <span
  608. class="pre">LICENSE_1_0.txt</span></tt> or copy at <a
  609. class="reference" target="_top"
  610. href="http://www.boost.org/LICENSE_1_0.txt">
  611. http://www.boost.org/LICENSE_1_0.txt</a>)</td>
  612. </tr>
  613. </tbody>
  614. </table>
  615. </td>
  616. </tr>
  617. </tbody>
  618. </table>
  619. </body>
  620. </html>