3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>strategy::distance::haversine</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="../strategies.html" title="Strategies">
9 <link rel="prev" href="strategy_distance_pythagoras_point_box.html" title="strategy::distance::pythagoras_point_box">
10 <link rel="next" href="strategy_distance_projected_point.html" title="strategy::distance::projected_point">
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="strategy_distance_pythagoras_point_box.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.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="strategy_distance_projected_point.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="geometry.reference.strategies.strategy_distance_haversine"></a><a class="link" href="strategy_distance_haversine.html" title="strategy::distance::haversine">strategy::distance::haversine</a>
28 </h4></div></div></div>
30 <a class="indexterm" name="idm46186972800752"></a><a class="indexterm" name="idm46186972800064"></a><a class="indexterm" name="idm46186972799376"></a>
31 Distance calculation for spherical coordinates on a perfect sphere using
35 <a name="geometry.reference.strategies.strategy_distance_haversine.h0"></a>
36 <span class="phrase"><a name="geometry.reference.strategies.strategy_distance_haversine.synopsis"></a></span><a class="link" href="strategy_distance_haversine.html#geometry.reference.strategies.strategy_distance_haversine.synopsis">Synopsis</a>
40 <pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">RadiusTypeOrSphere</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">CalculationType</span><span class="special">></span>
41 <span class="keyword">class</span> <span class="identifier">strategy</span><span class="special">::</span><span class="identifier">distance</span><span class="special">::</span><span class="identifier">haversine</span>
42 <span class="special">{</span>
43 <span class="comment">// ...</span>
44 <span class="special">};</span>
49 <a name="geometry.reference.strategies.strategy_distance_haversine.h1"></a>
50 <span class="phrase"><a name="geometry.reference.strategies.strategy_distance_haversine.template_parameter_s_"></a></span><a class="link" href="strategy_distance_haversine.html#geometry.reference.strategies.strategy_distance_haversine.template_parameter_s_">Template
53 <div class="informaltable"><table class="table">
80 typename RadiusTypeOrSphere
90 numeric type for radius (of sphere, earth) or sphere model
97 typename CalculationType
107 numeric type for calculation (e.g. high precision); if <span class="bold"><strong>void</strong></span> then it is extracted automatically
108 from the coordinate type and (if necessary) promoted to floating
116 <a name="geometry.reference.strategies.strategy_distance_haversine.h2"></a>
117 <span class="phrase"><a name="geometry.reference.strategies.strategy_distance_haversine.constructor_s_"></a></span><a class="link" href="strategy_distance_haversine.html#geometry.reference.strategies.strategy_distance_haversine.constructor_s_">Constructor(s)</a>
119 <div class="informaltable"><table class="table">
147 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">haversine</span><span class="special">()</span></pre>
153 Default constructor, radius set to 1.0 for the unit sphere.
163 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">RadiusOrSphere</span><span class="special">></span>
164 <span class="identifier">haversine</span><span class="special">(</span><span class="identifier">RadiusOrSphere</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">radius_or_sphere</span><span class="special">)</span></pre>
175 <span class="bold"><strong>RadiusOrSphere const &</strong></span>:
176 <span class="emphasis"><em>radius_or_sphere</em></span>: radius of the sphere or
184 <a name="geometry.reference.strategies.strategy_distance_haversine.h3"></a>
185 <span class="phrase"><a name="geometry.reference.strategies.strategy_distance_haversine.member_function_s_"></a></span><a class="link" href="strategy_distance_haversine.html#geometry.reference.strategies.strategy_distance_haversine.member_function_s_">Member
188 <div class="informaltable"><table class="table">
222 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Point1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Point2</span><span class="special">></span>
223 <span class="identifier">calculation_type</span><span class="special"><</span> <span class="identifier">Point1</span><span class="special">,</span> <span class="identifier">Point2</span> <span class="special">>::</span><span class="identifier">type</span> <span class="identifier">apply</span><span class="special">(</span><span class="identifier">Point1</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">p1</span><span class="special">,</span> <span class="identifier">Point2</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">p2</span><span class="special">)</span></pre>
229 applies the distance calculation
234 <span class="bold"><strong>Point1 const &</strong></span>: <span class="emphasis"><em>p1</em></span>:
238 <span class="bold"><strong>Point2 const &</strong></span>: <span class="emphasis"><em>p2</em></span>:
244 the calculated distance (including multiplying with radius)
252 <pre xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="table-programlisting"><span class="identifier">radius_type</span> <span class="identifier">radius</span><span class="special">()</span></pre>
258 access to radius value
272 <a name="geometry.reference.strategies.strategy_distance_haversine.h4"></a>
273 <span class="phrase"><a name="geometry.reference.strategies.strategy_distance_haversine.header"></a></span><a class="link" href="strategy_distance_haversine.html#geometry.reference.strategies.strategy_distance_haversine.header">Header</a>
276 <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">strategies</span><span class="special">/</span><span class="identifier">spherical</span><span class="special">/</span><span class="identifier">distance_haversine</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code>
279 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
280 <td align="left"></td>
281 <td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
282 Wulkiewicz, Oracle and/or its affiliates<p>
283 Distributed under the Boost Software License, Version 1.0. (See accompanying
284 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>)
289 <div class="spirit-nav">
290 <a accesskey="p" href="strategy_distance_pythagoras_point_box.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../strategies.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="strategy_distance_projected_point.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>