• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5<html xmlns="http://www.w3.org/1999/xhtml">
6  <head>
7    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
9    <title>Point - Boost.GIL  documentation</title>
10    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
11    <link rel="stylesheet" href="../_static/style.css" type="text/css" />
12    <script type="text/javascript">
13      var DOCUMENTATION_OPTIONS = {
14          URL_ROOT:    '../',
15          VERSION:     '',
16          COLLAPSE_MODINDEX: false,
17          FILE_SUFFIX: '.html'
18      };
19    </script>
20    <script type="text/javascript" src="../_static/jquery.js"></script>
21    <script type="text/javascript" src="../_static/underscore.js"></script>
22    <script type="text/javascript" src="../_static/doctools.js"></script>
23    <link rel="index" title="Index" href="../genindex.html" />
24    <link rel="search" title="Search" href="../search.html" />
25    <link rel="top" title="Boost.GIL  documentation" href="../index.html" />
26    <link rel="up" title="Design Guide" href="index.html" />
27    <link rel="next" title="Channel" href="channel.html" />
28    <link rel="prev" title="Concepts" href="concepts.html" />
29  </head>
30  <body>
31    <div class="header">
32    <table border="0" cellpadding="7" cellspacing="0" width="100%" summary=
33    "header">
34      <tr>
35        <td valign="top" width="300">
36          <h3><a href="../index.html"><img
37          alt="C++ Boost" src="../_static/gil.png" border="0"></a></h3>
38        </td>
39
40        <td >
41          <h1 align="center"><a href="../index.html"></a></h1>
42        </td>
43	<td>
44      <div id="searchbox" style="display: none">
45        <form class="search" action="../search.html" method="get">
46          <input type="text" name="q" size="18" />
47          <input type="submit" value="Search" />
48          <input type="hidden" name="check_keywords" value="yes" />
49          <input type="hidden" name="area" value="default" />
50        </form>
51      </div>
52      <script type="text/javascript">$('#searchbox').show(0);</script>
53	</td>
54      </tr>
55    </table>
56    </div>
57    <hr/>
58    <div class="content">
59    <div class="navbar" style="text-align:right;">
60
61
62      <a class="prev" title="Concepts" href="concepts.html"><img src="../_static/prev.png" alt="prev"/></a>
63      <a class="up" title="Design Guide" href="index.html"><img src="../_static/up.png" alt="up"/></a>
64      <a class="next" title="Channel" href="channel.html"><img src="../_static/next.png" alt="next"/></a>
65
66    </div>
67
68  <div class="section" id="point">
69<h1>Point</h1>
70<div class="contents local topic" id="contents">
71<ul class="simple">
72<li><a class="reference internal" href="#overview" id="id1">Overview</a></li>
73<li><a class="reference internal" href="#models" id="id2">Models</a></li>
74</ul>
75</div>
76<div class="section" id="overview">
77<h2><a class="toc-backref" href="#id1">Overview</a></h2>
78<p>A point defines the location of a pixel inside an image. It can also be used
79to describe the dimensions of an image. In most general terms, points are
80N-dimensional and model the following concept:</p>
81<div class="highlight-cpp"><div class="highlight"><pre><span class="n">concept</span> <span class="n">PointNDConcept</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="o">&gt;</span> <span class="o">:</span> <span class="n">Regular</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span>
82<span class="p">{</span>
83    <span class="c1">// the type of a coordinate along each axis</span>
84    <span class="k">template</span> <span class="o">&lt;</span><span class="kt">size_t</span> <span class="n">K</span><span class="o">&gt;</span> <span class="k">struct</span> <span class="n">axis</span><span class="p">;</span> <span class="n">where</span> <span class="n">Metafunction</span><span class="o">&lt;</span><span class="n">axis</span><span class="o">&gt;</span><span class="p">;</span>
85
86    <span class="k">const</span> <span class="kt">size_t</span> <span class="n">num_dimensions</span><span class="p">;</span>
87
88    <span class="c1">// accessor/modifier of the value of each axis.</span>
89    <span class="k">template</span> <span class="o">&lt;</span><span class="kt">size_t</span> <span class="n">K</span><span class="o">&gt;</span> <span class="k">const</span> <span class="k">typename</span> <span class="n">axis</span><span class="o">&lt;</span><span class="n">K</span><span class="o">&gt;::</span><span class="n">type</span><span class="o">&amp;</span> <span class="n">T</span><span class="o">::</span><span class="n">axis_value</span><span class="p">()</span> <span class="k">const</span><span class="p">;</span>
90    <span class="k">template</span> <span class="o">&lt;</span><span class="kt">size_t</span> <span class="n">K</span><span class="o">&gt;</span>       <span class="k">typename</span> <span class="n">axis</span><span class="o">&lt;</span><span class="n">K</span><span class="o">&gt;::</span><span class="n">type</span><span class="o">&amp;</span> <span class="n">T</span><span class="o">::</span><span class="n">axis_value</span><span class="p">();</span>
91<span class="p">};</span>
92</pre></div>
93</div>
94<p>GIL uses a two-dimensional point, which is a refinement of <code class="docutils literal"><span class="pre">PointNDConcept</span></code>
95in which both dimensions are of the same type:</p>
96<div class="highlight-cpp"><div class="highlight"><pre><span class="n">concept</span> <span class="n">Point2DConcept</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="o">&gt;</span> <span class="o">:</span> <span class="n">PointNDConcept</span><span class="o">&lt;</span><span class="n">T</span><span class="o">&gt;</span>
97<span class="p">{</span>
98    <span class="n">where</span> <span class="n">num_dimensions</span> <span class="o">==</span> <span class="mi">2</span><span class="p">;</span>
99    <span class="n">where</span> <span class="n">SameType</span><span class="o">&lt;</span><span class="n">axis</span><span class="o">&lt;</span><span class="mi">0</span><span class="o">&gt;::</span><span class="n">type</span><span class="p">,</span> <span class="n">axis</span><span class="o">&lt;</span><span class="mi">1</span><span class="o">&gt;::</span><span class="n">type</span><span class="o">&gt;</span><span class="p">;</span>
100
101    <span class="k">typename</span> <span class="n">value_type</span> <span class="o">=</span> <span class="n">axis</span><span class="o">&lt;</span><span class="mi">0</span><span class="o">&gt;::</span><span class="n">type</span><span class="p">;</span>
102
103    <span class="k">const</span> <span class="n">value_type</span><span class="o">&amp;</span> <span class="k">operator</span><span class="p">[](</span><span class="k">const</span> <span class="n">T</span><span class="o">&amp;</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">i</span><span class="p">);</span>
104        <span class="n">value_type</span><span class="o">&amp;</span> <span class="k">operator</span><span class="p">[](</span>      <span class="n">T</span><span class="o">&amp;</span><span class="p">,</span> <span class="kt">size_t</span> <span class="n">i</span><span class="p">);</span>
105
106    <span class="n">value_type</span> <span class="n">x</span><span class="p">,</span><span class="n">y</span><span class="p">;</span>
107<span class="p">};</span>
108</pre></div>
109</div>
110<div class="admonition seealso">
111<p class="first admonition-title">See also</p>
112<ul class="last simple">
113<li><a class="reference external" href="reference/structboost_1_1gil_1_1_point_n_d_concept.html">PointNDConcept</a></li>
114<li><a class="reference external" href="reference/structboost_1_1gil_1_1_point2_d_concept.html">Point2DConcept</a></li>
115</ul>
116</div>
117</div>
118<div class="section" id="models">
119<h2><a class="toc-backref" href="#id2">Models</a></h2>
120<p>GIL provides a model of <code class="docutils literal"><span class="pre">Point2DConcept</span></code>, <code class="docutils literal"><span class="pre">point&lt;T&gt;</span></code> where <code class="docutils literal"><span class="pre">T</span></code> is the
121coordinate type.</p>
122</div>
123</div>
124
125
126    <div class="navbar" style="text-align:right;">
127
128
129      <a class="prev" title="Concepts" href="concepts.html"><img src="../_static/prev.png" alt="prev"/></a>
130      <a class="up" title="Design Guide" href="index.html"><img src="../_static/up.png" alt="up"/></a>
131      <a class="next" title="Channel" href="channel.html"><img src="../_static/next.png" alt="next"/></a>
132
133    </div>
134    </div>
135    <div class="footer" role="contentinfo">
136      Last updated on 2020-08-11 15:08:48.
137      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.5.6.
138    </div>
139  </body>
140</html>