• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>model::d2::point_xy</title>
5<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../../index.html" title="Chapter 1. Geometry">
8<link rel="up" href="../models.html" title="Models">
9<link rel="prev" href="model_point.html" title="model::point">
10<link rel="next" href="model_d3_point_xyz.html" title="model::d3::point_xyz">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="model_point.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../models.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="model_d3_point_xyz.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h4 class="title">
27<a name="geometry.reference.models.model_d2_point_xy"></a><a class="link" href="model_d2_point_xy.html" title="model::d2::point_xy">model::d2::point_xy</a>
28</h4></div></div></div>
29<p>
30          <a class="indexterm" name="idm45635680668800"></a><a class="indexterm" name="idm45635680668112"></a><a class="indexterm" name="idm45635680667456"></a>
312D point in Cartesian coordinate system
32        </p>
33<h6>
34<a name="geometry.reference.models.model_d2_point_xy.h0"></a>
35          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.model_of"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.model_of">Model of</a>
36        </h6>
37<p>
38          <a class="link" href="../concepts/concept_point.html" title="Point Concept">Point Concept</a>
39        </p>
40<h6>
41<a name="geometry.reference.models.model_d2_point_xy.h1"></a>
42          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.synopsis"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.synopsis">Synopsis</a>
43        </h6>
44<p>
45</p>
46<pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">CoordinateType</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">CoordinateSystem</span><span class="special">&gt;</span>
47<span class="keyword">class</span> <span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span>
48      <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">model</span><span class="special">::</span><span class="identifier">point</span><span class="special">&lt;</span> <span class="identifier">CoordinateType</span><span class="special">,</span> <span class="number">2</span><span class="special">,</span> <span class="identifier">CoordinateSystem</span> <span class="special">&gt;</span>
49<span class="special">{</span>
50  <span class="comment">// ...</span>
51<span class="special">};</span>
52</pre>
53<p>
54        </p>
55<h6>
56<a name="geometry.reference.models.model_d2_point_xy.h2"></a>
57          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.template_parameter_s_"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.template_parameter_s_">Template
58          parameter(s)</a>
59        </h6>
60<div class="informaltable"><table class="table">
61<colgroup>
62<col>
63<col>
64<col>
65</colgroup>
66<thead><tr>
67<th>
68                  <p>
69                    Parameter
70                  </p>
71                </th>
72<th>
73                  <p>
74                    Default
75                  </p>
76                </th>
77<th>
78                  <p>
79                    Description
80                  </p>
81                </th>
82</tr></thead>
83<tbody>
84<tr>
85<td>
86                  <p>
87                    typename CoordinateType
88                  </p>
89                </td>
90<td>
91                </td>
92<td>
93                  <p>
94                    numeric type, for example, double, float, int
95                  </p>
96                </td>
97</tr>
98<tr>
99<td>
100                  <p>
101                    typename CoordinateSystem
102                  </p>
103                </td>
104<td>
105                  <p>
106                    cs::cartesian
107                  </p>
108                </td>
109<td>
110                  <p>
111                    coordinate system, defaults to cs::cartesian
112                  </p>
113                </td>
114</tr>
115</tbody>
116</table></div>
117<h6>
118<a name="geometry.reference.models.model_d2_point_xy.h3"></a>
119          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.constructor_s_"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.constructor_s_">Constructor(s)</a>
120        </h6>
121<div class="informaltable"><table class="table">
122<colgroup>
123<col>
124<col>
125<col>
126</colgroup>
127<thead><tr>
128<th>
129                  <p>
130                    Function
131                  </p>
132                </th>
133<th>
134                  <p>
135                    Description
136                  </p>
137                </th>
138<th>
139                  <p>
140                    Parameters
141                  </p>
142                </th>
143</tr></thead>
144<tbody>
145<tr>
146<td>
147                  <p>
148</p>
149<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">point_xy</span><span class="special">()</span></pre>
150<p>
151                  </p>
152                </td>
153<td>
154                  <p>
155                    Default constructor, no initialization.
156                  </p>
157                </td>
158<td>
159                </td>
160</tr>
161<tr>
162<td>
163                  <p>
164</p>
165<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">point_xy</span><span class="special">(</span><span class="identifier">CoordinateType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">,</span> <span class="identifier">CoordinateType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">y</span><span class="special">)</span></pre>
166<p>
167                  </p>
168                </td>
169<td>
170                  <p>
171                    Constructor with x/y values.
172                  </p>
173                </td>
174<td>
175                  <p>
176                    <span class="bold"><strong>CoordinateType const &amp;</strong></span>:
177                    <span class="emphasis"><em>x</em></span>:
178                  </p>
179                  <p>
180                    <span class="bold"><strong>CoordinateType const &amp;</strong></span>:
181                    <span class="emphasis"><em>y</em></span>:
182                  </p>
183                </td>
184</tr>
185</tbody>
186</table></div>
187<h6>
188<a name="geometry.reference.models.model_d2_point_xy.h4"></a>
189          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.member_function_s_"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.member_function_s_">Member
190          Function(s)</a>
191        </h6>
192<div class="informaltable"><table class="table">
193<colgroup>
194<col>
195<col>
196<col>
197<col>
198</colgroup>
199<thead><tr>
200<th>
201                  <p>
202                    Function
203                  </p>
204                </th>
205<th>
206                  <p>
207                    Description
208                  </p>
209                </th>
210<th>
211                  <p>
212                    Parameters
213                  </p>
214                </th>
215<th>
216                  <p>
217                    Returns
218                  </p>
219                </th>
220</tr></thead>
221<tbody>
222<tr>
223<td>
224                  <p>
225</p>
226<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">CoordinateType</span> <span class="keyword">const</span>  <span class="special">&amp;</span> <span class="identifier">x</span><span class="special">()</span></pre>
227<p>
228                  </p>
229                </td>
230<td>
231                  <p>
232                    Get x-value.
233                  </p>
234                </td>
235<td>
236                </td>
237<td>
238                </td>
239</tr>
240<tr>
241<td>
242                  <p>
243</p>
244<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">CoordinateType</span> <span class="keyword">const</span>  <span class="special">&amp;</span> <span class="identifier">y</span><span class="special">()</span></pre>
245<p>
246                  </p>
247                </td>
248<td>
249                  <p>
250                    Get y-value.
251                  </p>
252                </td>
253<td>
254                </td>
255<td>
256                </td>
257</tr>
258<tr>
259<td>
260                  <p>
261</p>
262<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span> <span class="identifier">x</span><span class="special">(</span><span class="identifier">CoordinateType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">v</span><span class="special">)</span></pre>
263<p>
264                  </p>
265                </td>
266<td>
267                  <p>
268                    Set x-value.
269                  </p>
270                </td>
271<td>
272                  <p>
273                    <span class="bold"><strong>CoordinateType const &amp;</strong></span>:
274                    <span class="emphasis"><em>v</em></span>:
275                  </p>
276                </td>
277<td>
278                </td>
279</tr>
280<tr>
281<td>
282                  <p>
283</p>
284<pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">void</span> <span class="identifier">y</span><span class="special">(</span><span class="identifier">CoordinateType</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">v</span><span class="special">)</span></pre>
285<p>
286                  </p>
287                </td>
288<td>
289                  <p>
290                    Set y-value.
291                  </p>
292                </td>
293<td>
294                  <p>
295                    <span class="bold"><strong>CoordinateType const &amp;</strong></span>:
296                    <span class="emphasis"><em>v</em></span>:
297                  </p>
298                </td>
299<td>
300                </td>
301</tr>
302</tbody>
303</table></div>
304<h6>
305<a name="geometry.reference.models.model_d2_point_xy.h5"></a>
306          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.header"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.header">Header</a>
307        </h6>
308<p>
309          <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
310        </p>
311<h6>
312<a name="geometry.reference.models.model_d2_point_xy.h6"></a>
313          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.examples"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.examples">Examples</a>
314        </h6>
315<p>
316          Declaration and use of the Boost.Geometry model::d2::point_xy, modelling
317          the Point Concept
318        </p>
319<p>
320</p>
321<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
322<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
323<span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">geometries</span><span class="special">/</span><span class="identifier">point_xy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
324
325<span class="keyword">namespace</span> <span class="identifier">bg</span> <span class="special">=</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">;</span>
326
327<span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
328<span class="special">{</span>
329    <span class="identifier">bg</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">point1</span><span class="special">;</span>
330    <span class="identifier">bg</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">d2</span><span class="special">::</span><span class="identifier">point_xy</span><span class="special">&lt;</span><span class="keyword">double</span><span class="special">&gt;</span> <span class="identifier">point2</span><span class="special">(</span><span class="number">1.0</span><span class="special">,</span> <span class="number">2.0</span><span class="special">);</span> <a class="co" name="geometry.reference.models.model_d2_point_xy.c0" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.c1"><img src="../../../../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a>
331
332    <span class="identifier">bg</span><span class="special">::</span><span class="identifier">set</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">point1</span><span class="special">,</span> <span class="number">1.0</span><span class="special">);</span> <a class="co" name="geometry.reference.models.model_d2_point_xy.c2" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.c3"><img src="../../../../../../../doc/src/images/callouts/2.png" alt="2" border="0"></a>
333    <span class="identifier">point1</span><span class="special">.</span><span class="identifier">y</span><span class="special">(</span><span class="number">2.0</span><span class="special">);</span> <a class="co" name="geometry.reference.models.model_d2_point_xy.c4" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.c5"><img src="../../../../../../../doc/src/images/callouts/3.png" alt="3" border="0"></a>
334
335    <span class="keyword">double</span> <span class="identifier">x</span> <span class="special">=</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">get</span><span class="special">&lt;</span><span class="number">0</span><span class="special">&gt;(</span><span class="identifier">point1</span><span class="special">);</span> <a class="co" name="geometry.reference.models.model_d2_point_xy.c6" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.c7"><img src="../../../../../../../doc/src/images/callouts/4.png" alt="4" border="0"></a>
336    <span class="keyword">double</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">point1</span><span class="special">.</span><span class="identifier">y</span><span class="special">();</span> <a class="co" name="geometry.reference.models.model_d2_point_xy.c8" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.c9"><img src="../../../../../../../doc/src/images/callouts/5.png" alt="5" border="0"></a>
337
338    <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="identifier">x</span> <span class="special">&lt;&lt;</span> <span class="string">", "</span> <span class="special">&lt;&lt;</span> <span class="identifier">y</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
339    <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
340<span class="special">}</span>
341</pre>
342<p>
343        </p>
344<div class="calloutlist"><table border="0" summary="Callout list">
345<tr>
346<td width="5%" valign="top" align="left"><p><a name="geometry.reference.models.model_d2_point_xy.c1"></a><a href="#geometry.reference.models.model_d2_point_xy.c0"><img src="../../../../../../../doc/src/images/callouts/1.png" alt="1" border="0"></a> </p></td>
347<td valign="top" align="left"><p>
348              Construct, assigning coordinates.
349            </p></td>
350</tr>
351<tr>
352<td width="5%" valign="top" align="left"><p><a name="geometry.reference.models.model_d2_point_xy.c3"></a><a href="#geometry.reference.models.model_d2_point_xy.c2"><img src="../../../../../../../doc/src/images/callouts/2.png" alt="2" border="0"></a> </p></td>
353<td valign="top" align="left"><p>
354              Set a coordinate, generic.
355            </p></td>
356</tr>
357<tr>
358<td width="5%" valign="top" align="left"><p><a name="geometry.reference.models.model_d2_point_xy.c5"></a><a href="#geometry.reference.models.model_d2_point_xy.c4"><img src="../../../../../../../doc/src/images/callouts/3.png" alt="3" border="0"></a> </p></td>
359<td valign="top" align="left"><p>
360              Set a coordinate, class-specific (<span class="bold"><strong>Note</strong></span>:
361              prefer <code class="computeroutput"><span class="identifier">bg</span><span class="special">::</span><span class="identifier">set</span><span class="special">()</span></code>).
362            </p></td>
363</tr>
364<tr>
365<td width="5%" valign="top" align="left"><p><a name="geometry.reference.models.model_d2_point_xy.c7"></a><a href="#geometry.reference.models.model_d2_point_xy.c6"><img src="../../../../../../../doc/src/images/callouts/4.png" alt="4" border="0"></a> </p></td>
366<td valign="top" align="left"><p>
367              Get a coordinate, generic.
368            </p></td>
369</tr>
370<tr>
371<td width="5%" valign="top" align="left"><p><a name="geometry.reference.models.model_d2_point_xy.c9"></a><a href="#geometry.reference.models.model_d2_point_xy.c8"><img src="../../../../../../../doc/src/images/callouts/5.png" alt="5" border="0"></a> </p></td>
372<td valign="top" align="left"><p>
373              Get a coordinate, class-specific (<span class="bold"><strong>Note</strong></span>:
374              prefer <code class="computeroutput"><span class="identifier">bg</span><span class="special">::</span><span class="identifier">get</span><span class="special">()</span></code>).
375            </p></td>
376</tr>
377</table></div>
378<p>
379          Output:
380        </p>
381<pre class="programlisting">1, 2
382</pre>
383<h6>
384<a name="geometry.reference.models.model_d2_point_xy.h7"></a>
385          <span class="phrase"><a name="geometry.reference.models.model_d2_point_xy.notes"></a></span><a class="link" href="model_d2_point_xy.html#geometry.reference.models.model_d2_point_xy.notes">Notes</a>
386        </h6>
387<div class="note"><table border="0" summary="Note">
388<tr>
389<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../doc/src/images/note.png"></td>
390<th align="left">Note</th>
391</tr>
392<tr><td align="left" valign="top"><p>
393            Coordinates are not initialized. If the constructor with parameters is
394            not called and points are not assigned using <code class="computeroutput"><span class="identifier">set</span></code>
395            or <code class="computeroutput"><span class="identifier">assign</span></code> then the coordinate
396            values will contain garbage
397          </p></td></tr>
398</table></div>
399</div>
400<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
401<td align="left"></td>
402<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
403      Wulkiewicz, Oracle and/or its affiliates<p>
404        Distributed under the Boost Software License, Version 1.0. (See accompanying
405        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
406      </p>
407</div></td>
408</tr></table>
409<hr>
410<div class="spirit-nav">
411<a accesskey="p" href="model_point.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../models.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="model_d3_point_xyz.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
412</div>
413</body>
414</html>
415