3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
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="../get.html" title="get">
9 <link rel="prev" href="../get.html" title="get">
10 <link rel="next" href="get_1_with_index.html" title="get (with index)">
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>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../get.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../get.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="get_1_with_index.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h5 class="title">
27 <a name="geometry.reference.access.get.get_1"></a><a class="link" href="get_1.html" title="get">get</a>
28 </h5></div></div></div>
30 <a class="indexterm" name="idm46187014731360"></a>
31 Get coordinate value of a geometry (usually a point)
34 <a name="geometry.reference.access.get.get_1.h0"></a>
35 <span class="phrase"><a name="geometry.reference.access.get.get_1.description"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.description">Description</a>
38 The free functions <span class="bold"><strong>get</strong></span> and <span class="bold"><strong>set</strong></span> are two of the most important functions of
39 Boost.Geometry, both within the library, as also for the library user.
40 With these two functions you normally get and set coordinate values from
41 and for a point, box, segment or sphere.
44 <a name="geometry.reference.access.get.get_1.h1"></a>
45 <span class="phrase"><a name="geometry.reference.access.get.get_1.synopsis"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.synopsis">Synopsis</a>
49 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">size_t</span> <span class="identifier">Dimension</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Geometry</span><span class="special">></span>
50 <span class="identifier">coordinate_type</span><span class="special"><</span><span class="identifier">Geometry</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">get</span><span class="special">(</span><span class="identifier">Geometry</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">geometry</span><span class="special">)</span></pre>
54 <a name="geometry.reference.access.get.get_1.h2"></a>
55 <span class="phrase"><a name="geometry.reference.access.get.get_1.parameters"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.parameters">Parameters</a>
57 <div class="informaltable"><table class="table">
95 Dimension, this template parameter is required. Should contain
96 [0 .. n-1] for an n-dimensional geometry
118 Any type fulfilling a Geometry Concept (usually a Point Concept)
128 A model of the specified concept (usually a point)
135 <a name="geometry.reference.access.get.get_1.h3"></a>
136 <span class="phrase"><a name="geometry.reference.access.get.get_1.returns"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.returns">Returns</a>
139 The coordinate value of specified dimension of specified geometry
142 <a name="geometry.reference.access.get.get_1.h4"></a>
143 <span class="phrase"><a name="geometry.reference.access.get.get_1.header"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.header">Header</a>
149 <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</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">></span></code>
155 <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">geometry</span><span class="special">/</span><span class="identifier">core</span><span class="special">/</span><span class="identifier">access</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
158 <a name="geometry.reference.access.get.get_1.h5"></a>
159 <span class="phrase"><a name="geometry.reference.access.get.get_1.behavior"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.behavior">Behavior</a>
161 <div class="informaltable"><table class="table">
187 Returns the coordinate of a point
199 Returns the coordinate of the center of a circle or sphere
200 (currently in an extension)
212 Returns the coordinate of a point, in either Radian's or Degree's,
213 depending on specified units
220 <a name="geometry.reference.access.get.get_1.h6"></a>
221 <span class="phrase"><a name="geometry.reference.access.get.get_1.complexity"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.complexity">Complexity</a>
227 <a name="geometry.reference.access.get.get_1.h7"></a>
228 <span class="phrase"><a name="geometry.reference.access.get.get_1.example"></a></span><a class="link" href="get_1.html#geometry.reference.access.get.get_1.example">Example</a>
231 Get the coordinate of a point
235 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
237 <span class="preprocessor">#include</span> <span class="special"><</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">></span>
238 <span class="preprocessor">#include</span> <span class="special"><</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">></span>
240 <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>
242 <span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
243 <span class="special">{</span>
244 <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"><</span><span class="keyword">double</span><span class="special">></span> <span class="identifier">point</span><span class="special">(</span><span class="number">1</span><span class="special">,</span> <span class="number">2</span><span class="special">);</span>
246 <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"><</span><span class="number">0</span><span class="special">>(</span><span class="identifier">point</span><span class="special">);</span>
247 <span class="keyword">double</span> <span class="identifier">y</span> <span class="special">=</span> <span class="identifier">bg</span><span class="special">::</span><span class="identifier">get</span><span class="special"><</span><span class="number">1</span><span class="special">>(</span><span class="identifier">point</span><span class="special">);</span>
249 <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"x="</span> <span class="special"><<</span> <span class="identifier">x</span> <span class="special"><<</span> <span class="string">" y="</span> <span class="special"><<</span> <span class="identifier">y</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
251 <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
252 <span class="special">}</span>
259 <pre class="programlisting">x=1 y=2
262 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
263 <td align="left"></td>
264 <td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
265 Wulkiewicz, Oracle and/or its affiliates<p>
266 Distributed under the Boost Software License, Version 1.0. (See accompanying
267 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>)
272 <div class="spirit-nav">
273 <a accesskey="p" href="../get.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../get.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="get_1_with_index.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>