gtl_point_concept.htm 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  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: Point 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>Point Concept</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>Point Concept</h1>
  93. <p> </p>
  94. <p> The point concept tag is <font face="Courier New">
  95. point_concept</font></p>
  96. <p> To register a user defined type as a model of point concept,
  97. specialize the geometry concept meta-function for that type.&nbsp; In
  98. the example below <span
  99. style="font-family: Courier New,Courier,monospace;">CPoint</span> is
  100. registered as a model of point&nbsp; concept.</p>
  101. <p> <font face="Courier New">template &lt;&gt;<br />
  102. struct geometry_concept&lt;CPoint&gt; { typedef point_concept type; };</font></p>
  103. <p> The semantic of a point is that it has an x and y
  104. coordinate.&nbsp; A std::pair&lt;int, int&gt;, boost::tuple&lt;int,
  105. int&gt; or boost::array&lt;int, 2&gt; could all be made models of point
  106. by simply providing indirect access to their elements through traits,
  107. however, these objects cannot be made a model of both point and
  108. interval in the same compilation unit, for obvious reason that
  109. duplicate specialization of the geometry_concept struct is illegal, but
  110. also because it would make overloading generic function by concept
  111. ambiguous if a type modeled more than one concept.</p>
  112. <p> Below is shown the default point traits.&nbsp; Specialization
  113. of these traits is required for types that don't conform to the default
  114. behavior.</p>
  115. <p style="font-family: Courier New,Courier,monospace;"> template
  116. &lt;typename T&gt;<br />
  117. struct point_traits {<br />
  118. &nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::coordinate_type
  119. coordinate_type;<br />
  120. <br />
  121. &nbsp;&nbsp;&nbsp;&nbsp; static coordinate_type get(const T&amp; point,
  122. orientation_2d orient) {<br />
  123. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
  124. point.get(orient);
  125. <br />
  126. &nbsp;&nbsp;&nbsp;&nbsp; }<br />
  127. };<br />
  128. <br />
  129. template &lt;typename T&gt;<br />
  130. struct point_mutable_traits {<br />
  131. &nbsp;&nbsp;&nbsp;&nbsp; typedef typename T::coordinate_type
  132. coordinate_type;<br />
  133. <br />
  134. &nbsp;&nbsp;&nbsp;&nbsp; static void set(T&amp; point, orientation_2d
  135. orient, typename point_traits&lt;T&gt;::coordinate_type value) {<br />
  136. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  137. point.set(orient, value);
  138. <br />
  139. &nbsp;&nbsp;&nbsp;&nbsp; }<br />
  140. &nbsp;&nbsp;&nbsp;&nbsp; static T construct(typename
  141. point_traits&lt;T&gt;::coordinate_type x_value,<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;
  143. typename point_traits&lt;T&gt;::coordinate_type y_value) {<br />
  144. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return
  145. T(x_value, y_value);
  146. <br />
  147. &nbsp;&nbsp;&nbsp;&nbsp; }<br />
  148. };</p>
  149. <p> Example code <a href="gtl_custom_point.htm">custom_point.cpp</a>
  150. demonstrates how to map a user defined point class to the library
  151. point_concept</p>
  152. <h2>Functions</h2>
  153. <table id="table1" border="1" width="100%">
  154. <tbody>
  155. <tr>
  156. <td width="586"><font face="Courier New">template
  157. &lt;typename PointType&gt;<br />
  158. coordinate_type <b>get</b>(const PointType&amp; point,<br />
  159. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  160. orientation_2d)</font></td>
  161. <td>Expects a model of point. Returns the x or y coordinate
  162. of the point, depending on the orientation_2d value.<br />
  163. &nbsp;</td>
  164. </tr>
  165. <tr>
  166. <td width="586"><font face="Courier New">template
  167. &lt;typename PointType&gt;<br />
  168. void <b>set</b>(PointType&amp; point, orientation_2d,<br />
  169. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; coordinate_type)</font></td>
  170. <td>Expects a model of point. Sets the x or y coordinate of
  171. the point to the coordinate, depending on the orientation_2d&nbsp;
  172. value. </td>
  173. </tr>
  174. <tr>
  175. <td width="586"><font face="Courier New">template
  176. &lt;typename PointType&gt;<br />
  177. PointType <b>construct</b>(coordinate_type x,<br />
  178. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  179. coordinate_type y)</font></td>
  180. <td>Construct an object that is a model of point given x
  181. and y coordinate values.</td>
  182. </tr>
  183. <tr>
  184. <td width="586"><font face="Courier New">template
  185. &lt;typename PointType1, typename PointType2&gt;<br />
  186. PointType1&amp; <b>assign</b>(PointType1&amp; left,<br />
  187. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  188. const PointType2&amp; right)</font></td>
  189. <td>Copies data from right object that models point into
  190. left object that models point.</td>
  191. </tr>
  192. <tr>
  193. <td width="586"><font face="Courier New">template
  194. &lt;typename PointType1, typename PointType2&gt;<br />
  195. bool <b>equivalence</b>(const </font><font face="Courier New">PointType1</font><font
  196. face="Courier New">&amp; point1,<br />
  197. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  198. const </font><font face="Courier New">PointType2</font><font
  199. face="Courier New">&amp; point2)</font></td>
  200. <td>Given two objects that model point, compares and
  201. returns true if their x and y values are respectively equal to each
  202. other.</td>
  203. </tr>
  204. <tr>
  205. <td width="586"><font face="Courier New">template
  206. &lt;typename PointType&gt;<br />
  207. coordinate_type <b>x</b>(const </font><font face="Courier New">PointType</font><font
  208. face="Courier New">&amp; point)</font></td>
  209. <td>Returns the x coordinate of an object that models point.</td>
  210. </tr>
  211. <tr>
  212. <td width="586"><font face="Courier New">template
  213. &lt;typename </font><font face="Courier New">PointType</font><font
  214. face="Courier New">&gt;<br />
  215. coordinate_type <b>y</b>(const </font><font face="Courier New">PointType</font><font
  216. face="Courier New">&amp; point)</font></td>
  217. <td>Returns the y coordinate of an object that models point.</td>
  218. </tr>
  219. <tr>
  220. <td width="586"><font face="Courier New">template
  221. &lt;typename </font><font face="Courier New">PointType</font><font
  222. face="Courier New">&gt;<br />
  223. void <b>x</b>(p</font><font face="Courier New">PointType</font><font
  224. face="Courier New">&amp; point, coordinate_type )</font></td>
  225. <td>Sets the x coordinate of the object that models point
  226. to the coordinate value.&nbsp; </td>
  227. </tr>
  228. <tr>
  229. <td width="586"><font face="Courier New">template
  230. &lt;typename </font><font face="Courier New">PointType</font><font
  231. face="Courier New">&gt;<br />
  232. void <b>y</b>(</font><font face="Courier New">PointType</font><font
  233. face="Courier New">&amp; point, coordinate_type )</font></td>
  234. <td>Sets the y coordinate of the object that models point
  235. to the coordinate value.&nbsp; </td>
  236. </tr>
  237. <tr>
  238. <td width="586"><font face="Courier New">template
  239. &lt;typename </font><font face="Courier New">PointType</font><font
  240. face="Courier New">&gt;<br />
  241. point_type&amp; <b>scale_up</b>(</font><font face="Courier New">PointType</font><font
  242. face="Courier New">&amp; point, <br />
  243. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  244. unsigned_area_type factor)</font></td>
  245. <td>Multiplies x and y coordinate of an object that models
  246. point by unsigned factor.</td>
  247. </tr>
  248. <tr>
  249. <td width="586"><font face="Courier New">template
  250. &lt;typename </font><font face="Courier New">PointType</font><font
  251. face="Courier New">&gt;<br />
  252. point_type&amp; <b>scale_down</b>(</font><font face="Courier New">PointType</font><font
  253. face="Courier New">&amp; point, <br />
  254. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  255. unsigned_area_type factor)</font></td>
  256. <td>Divides x and y coordinate of an object that models
  257. point by unsigned factor.</td>
  258. </tr>
  259. <tr>
  260. <td width="586"><font face="Courier New">template
  261. &lt;typename </font><font face="Courier New">PointType</font><font
  262. face="Courier New">, typename scaling_type&gt;<br />
  263. point_type&amp; <b>scale</b>(</font><font face="Courier New">PointType</font><font
  264. face="Courier New">&amp; point,<br />
  265. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  266. const scaling_type&amp; factor) </font></td>
  267. <td>Calls the scale member function of scaling type on the
  268. x and y value of an object that models point and sets the point to the
  269. scaled values.</td>
  270. </tr>
  271. <tr>
  272. <td width="586"><font face="Courier New">template
  273. &lt;typename </font><font face="Courier New">PointType</font><font
  274. face="Courier New">, typename transform_type&gt;<br />
  275. point_type&amp; <b>transform</b>(</font><font face="Courier New">PointType</font><font
  276. face="Courier New">&amp; point,<br />
  277. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  278. const transform_type&amp; transform) </font></td>
  279. <td>Calls the transform member function of transform type
  280. on the x and y value of an object that models point and sets the point
  281. to the transformed values.</td>
  282. </tr>
  283. <tr>
  284. <td width="586"><font face="Courier New">template
  285. &lt;typename </font><font face="Courier New">PointType</font><font
  286. face="Courier New">&gt;<br />
  287. point_type&amp; <b>move</b>(</font><font face="Courier New">PointType</font><font
  288. face="Courier New">&amp; point, orientation_2d,<br />
  289. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  290. coordinate_difference displacement)</font></td>
  291. <td>Adds displacement value to the coordinate of an object
  292. that models point indicated by the orientation_2d.</td>
  293. </tr>
  294. <tr>
  295. <td width="586"><font face="Courier New">template
  296. &lt;typename </font><font face="Courier New">PointType</font><font
  297. face="Courier New">1, typename PointType2&gt;<br />
  298. </font><font face="Courier New">PointType</font><font
  299. face="Courier New">1</font><font face="Courier New">&amp; <b>convolve</b>(</font><font
  300. face="Courier New">PointType</font><font face="Courier New">1</font><font
  301. face="Courier New">&amp; a,<br />
  302. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  303. const </font><font face="Courier New">PointType2</font><font
  304. face="Courier New">&amp; b)</font></td>
  305. <td>Adds x coordinate of b to x coordinate of a and adds y
  306. coordinate of b to y coordinate of a.</td>
  307. </tr>
  308. <tr>
  309. <td width="586"><font face="Courier New">template
  310. &lt;typename </font><font face="Courier New">PointType</font><font
  311. face="Courier New">1</font><font face="Courier New">, typename </font><font
  312. face="Courier New">PointType</font><span
  313. style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
  314. </font><font face="Courier New">PointType</font><font
  315. face="Courier New">1</font><font face="Courier New">,</font><font
  316. face="Courier New">&amp; <b>deconvolve</b>(</font><font
  317. face="Courier New">PointType</font><font face="Courier New">1</font><font
  318. face="Courier New">&amp; a,<br />
  319. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  320. const </font><font face="Courier New">PointType</font><span
  321. style="font-family: Courier New;">2</span><font face="Courier New">&gt;</font><font
  322. face="Courier New">&amp; b)</font></td>
  323. <td>Subtracts x coordinate of b from x coordinate of a and
  324. subtracts y coordinate of b from y coordinate of a. </td>
  325. </tr>
  326. <tr>
  327. <td width="586"><font face="Courier New">template
  328. &lt;typename </font><font face="Courier New">PointType</font><font
  329. face="Courier New">1</font><font face="Courier New">, typename </font><font
  330. face="Courier New">PointType</font><span
  331. style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
  332. distance_type <b>euclidean_distance</b>(<br />
  333. &nbsp;&nbsp;&nbsp; const </font><font face="Courier New">PointType</font><font
  334. face="Courier New">1</font><font face="Courier New">&amp;, const </font><font
  335. face="Courier New">PointType</font><span
  336. style="font-family: Courier New;">2</span><font face="Courier New">&amp;)</font></td>
  337. <td>Returns the distance from an object that models point
  338. to a second object that models point.</td>
  339. </tr>
  340. <tr>
  341. <td width="586"><font face="Courier New">template &lt;</font><font
  342. face="Courier New">typename </font><font face="Courier New">PointType</font><font
  343. face="Courier New">1</font><font face="Courier New">, typename </font><font
  344. face="Courier New">PointType</font><span
  345. style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
  346. coordinate_difference <b>euclidean_distance</b>(<br />
  347. &nbsp;&nbsp;&nbsp; const </font><font face="Courier New">PointType</font><font
  348. face="Courier New">1</font><font face="Courier New">&amp;, </font><font
  349. face="Courier New">const PointType</font><span
  350. style="font-family: Courier New;">2&amp;,</span><font
  351. face="Courier New"> orientation_2d)</font></td>
  352. <td>Returns the distance from an object that models point
  353. to a coordinate in the given orientation_2d.</td>
  354. </tr>
  355. <tr>
  356. <td width="586"><font face="Courier New">template &lt;</font><font
  357. face="Courier New">typename </font><font face="Courier New">PointType</font><font
  358. face="Courier New">1</font><font face="Courier New">, typename </font><font
  359. face="Courier New">PointType</font><span
  360. style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
  361. coordinate_difference <b>manhattan_distance</b>(<br />
  362. &nbsp;&nbsp;&nbsp; </font><font face="Courier New">const </font><font
  363. face="Courier New">PointType</font><font face="Courier New">1</font><font
  364. face="Courier New">&amp;, </font><font face="Courier New">const
  365. PointType</font><span style="font-family: Courier New;">2&amp;</span><font
  366. face="Courier New">)</font></td>
  367. <td>Returns the distance in x plus the distance in y from
  368. an object that models point to a second object that models point.</td>
  369. </tr>
  370. <tr>
  371. <td width="586"><font face="Courier New">template &lt;</font><font
  372. face="Courier New">typename </font><font face="Courier New">PointType</font><font
  373. face="Courier New">1</font><font face="Courier New">, typename </font><font
  374. face="Courier New">PointType</font><span
  375. style="font-family: Courier New;">2</span><font face="Courier New">&gt;<br />
  376. coordinate_difference <b>distance_squared</b>(<br />
  377. &nbsp;&nbsp;&nbsp; </font><font face="Courier New">const </font><font
  378. face="Courier New">PointType</font><font face="Courier New">1</font><font
  379. face="Courier New">&amp;, </font><font face="Courier New">const
  380. PointType</font><span style="font-family: Courier New;">2&amp;</span><font
  381. face="Courier New">)</font></td>
  382. <td>Returns the square of the distance in x plus the square
  383. of the distance in y from an object that models point to a second
  384. object that models point.</td>
  385. </tr>
  386. </tbody>
  387. </table>
  388. <h1>Point Data</h1>
  389. <p> </p>
  390. <p>The library provides a model of point concept declared
  391. <font face="Courier New">template&lt;typename T&gt; point_data </font>where
  392. T is the coordinate type.</p>
  393. <p>This data type is used internally when a point is needed and
  394. is available to the library user who finds it convenient to use a
  395. library point data type instead of providing their own.&nbsp; The data
  396. type is implemented to be convenient to use with the library traits.</p>
  397. <p>Example code <a href="gtl_point_usage.htm">point_usage.cpp</a>
  398. demonstrates using the library provided point data type and functions</p>
  399. <h2>Members</h2>
  400. <table id="table2" border="1" width="100%">
  401. <tbody>
  402. <tr>
  403. <td width="586"><b><font face="Courier New">coordinate_type</font></b></td>
  404. <td>T</td>
  405. </tr>
  406. <tr>
  407. <td width="586"><font face="Courier New"><b>point_data</b>()</font></td>
  408. <td>Default constructs the two coordinate values of the
  409. point.</td>
  410. </tr>
  411. <tr>
  412. <td width="586"><font face="Courier New"><b>point_data</b>(T
  413. x, T y)</font></td>
  414. <td>Constructs an interval with two coordinates.</td>
  415. </tr>
  416. <tr>
  417. <td width="586"><font face="Courier New"><b>point_data</b>(const
  418. point_data&amp; that)</font></td>
  419. <td>Copy construct</td>
  420. </tr>
  421. <tr>
  422. <td width="586"><font face="Courier New">point_data&amp; <b>operator=</b>(const
  423. point_data&amp; that)</font></td>
  424. <td>Assignment operator.</td>
  425. </tr>
  426. <tr>
  427. <td width="586"><font face="Courier New">template
  428. &lt;typename PointType&gt;<br />
  429. point_data&amp; <b>operator=</b>(const PointType&amp; that) const</font></td>
  430. <td>Assign from an object that is a model of point.</td>
  431. </tr>
  432. <tr>
  433. <td width="586"><font face="Courier New">bool<b> operator==</b>(const
  434. </font><font face="Courier New">point_data</font><font
  435. face="Courier New">&amp; that) const</font></td>
  436. <td>Equality operator overload.<br />
  437. </td>
  438. </tr>
  439. <tr>
  440. <td width="586"><font face="Courier New">bool<b> operator!=</b>(const
  441. </font><font face="Courier New">point_data</font><font
  442. face="Courier New">&amp; that) const</font></td>
  443. <td>Inequality operator overload.</td>
  444. </tr>
  445. <tr>
  446. <td width="586"><font face="Courier New"><b> </b>bool<b>
  447. operator&lt;</b>(const </font><font face="Courier New">point_data</font><font
  448. face="Courier New">&amp; that) const</font></td>
  449. <td>Compares y coordinates then x coordinates to break ties.</td>
  450. </tr>
  451. <tr>
  452. <td width="586"><font face="Courier New"><b> </b>bool<b>
  453. operator&lt;=</b>(const </font><font face="Courier New">point_data</font><font
  454. face="Courier New">&amp; that) const</font></td>
  455. <td>Compares y coordinates then x coordinates to break ties.</td>
  456. </tr>
  457. <tr>
  458. <td width="586"><font face="Courier New"><b> </b>bool<b>
  459. operator&gt;</b>(const </font><font face="Courier New">point_data</font><font
  460. face="Courier New">&amp; that) const</font></td>
  461. <td>Compares low coordinates then high coordinates to break
  462. ties.</td>
  463. </tr>
  464. <tr>
  465. <td width="586"><font face="Courier New">bool<b>
  466. operator&gt;=</b>(const </font><font face="Courier New">point_data</font><font
  467. face="Courier New">&amp; that) const</font></td>
  468. <td>Compares low coordinates then high coordinates to break
  469. ties.</td>
  470. </tr>
  471. <tr>
  472. <td width="586"><font face="Courier New">T <b>get</b>(orientation_2d
  473. orient) const</font></td>
  474. <td>Get the coordinate in the given orientation.</td>
  475. </tr>
  476. <tr>
  477. <td width="586"><font face="Courier New">T <b>x</b>() const</font></td>
  478. <td>Get the coordinate in the horizontal orientation.</td>
  479. </tr>
  480. <tr>
  481. <td width="586"><font face="Courier New">T <b>y</b>() const</font></td>
  482. <td>Get the coordinate in the vertical orientation.</td>
  483. </tr>
  484. <tr>
  485. <td width="586"><font face="Courier New">void <b>set</b>(orientation_2d
  486. orient, T value)</font></td>
  487. <td>Sets the coordinate in the given orientation to the
  488. value.</td>
  489. </tr>
  490. <tr>
  491. <td width="586"><font face="Courier New">void <b>x</b>(T
  492. value)</font></td>
  493. <td>Sets the coordinate in the horizontal orientation to
  494. the value.</td>
  495. </tr>
  496. <tr>
  497. <td width="586"><font face="Courier New">void <b>y</b>(T
  498. value)</font></td>
  499. <td>Sets the coordinate in the vertical orientation to the
  500. value.</td>
  501. </tr>
  502. </tbody>
  503. </table>
  504. </td>
  505. </tr>
  506. <tr>
  507. <td style="background-color: rgb(238, 238, 238);" nowrap="1"
  508. valign="top"> &nbsp;</td>
  509. <td
  510. style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;"
  511. valign="top" width="100%">
  512. <table class="docinfo" id="table3" frame="void" rules="none">
  513. <colgroup> <col class="docinfo-name" /><col
  514. class="docinfo-content" /> </colgroup> <tbody valign="top">
  515. <tr>
  516. <th class="docinfo-name">Copyright:</th>
  517. <td>Copyright © Intel Corporation 2008-2010.</td>
  518. </tr>
  519. <tr class="field">
  520. <th class="docinfo-name">License:</th>
  521. <td class="field-body">Distributed under the Boost Software
  522. License, Version 1.0. (See accompanying file <tt class="literal"> <span
  523. class="pre">LICENSE_1_0.txt</span></tt> or copy at <a
  524. class="reference" target="_top"
  525. href="http://www.boost.org/LICENSE_1_0.txt">
  526. http://www.boost.org/LICENSE_1_0.txt</a>)</td>
  527. </tr>
  528. </tbody>
  529. </table>
  530. </td>
  531. </tr>
  532. </tbody>
  533. </table>
  534. </body>
  535. </html>