1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>distance (with strategy)</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="../distance.html" title="distance"> 9<link rel="prev" href="comparable_distance_2.html" title="comparable_distance"> 10<link rel="next" href="distance_2.html" title="distance"> 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="comparable_distance_2.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../distance.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="distance_2.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h5 class="title"> 27<a name="geometry.reference.algorithms.distance.distance_3_with_strategy"></a><a class="link" href="distance_3_with_strategy.html" title="distance (with strategy)">distance 28 (with strategy)</a> 29</h5></div></div></div> 30<p> 31 <a class="indexterm" name="idm45635699073376"></a> 32Calculate the distance between two geometries using the specified strategy. 33 </p> 34<h6> 35<a name="geometry.reference.algorithms.distance.distance_3_with_strategy.h0"></a> 36 <span class="phrase"><a name="geometry.reference.algorithms.distance.distance_3_with_strategy.description"></a></span><a class="link" href="distance_3_with_strategy.html#geometry.reference.algorithms.distance.distance_3_with_strategy.description">Description</a> 37 </h6> 38<p> 39 The free function distance calculates the distance between two geometries 40 using the specified strategy. Reasons to specify a strategy include: 41 use another coordinate system for calculations; construct the strategy 42 beforehand (e.g. with the radius of the Earth); select a strategy when 43 there are more than one available for a calculation. 44 </p> 45<h6> 46<a name="geometry.reference.algorithms.distance.distance_3_with_strategy.h1"></a> 47 <span class="phrase"><a name="geometry.reference.algorithms.distance.distance_3_with_strategy.synopsis"></a></span><a class="link" href="distance_3_with_strategy.html#geometry.reference.algorithms.distance.distance_3_with_strategy.synopsis">Synopsis</a> 48 </h6> 49<p> 50</p> 51<pre class="programlisting"><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> <span class="identifier">Geometry1</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Geometry2</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Strategy</span><span class="special">></span> 52<span class="identifier">distance_result</span><span class="special"><</span><span class="identifier">Geometry1</span><span class="special">,</span> <span class="identifier">Geometry2</span><span class="special">,</span> <span class="identifier">Strategy</span><span class="special">>::</span><span class="identifier">type</span> <span class="identifier">distance</span><span class="special">(</span><span class="identifier">Geometry1</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">geometry1</span><span class="special">,</span> <span class="identifier">Geometry2</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">geometry2</span><span class="special">,</span> <span class="identifier">Strategy</span> <span class="keyword">const</span> <span class="special">&</span> <span class="identifier">strategy</span><span class="special">)</span></pre> 53<p> 54 </p> 55<h6> 56<a name="geometry.reference.algorithms.distance.distance_3_with_strategy.h2"></a> 57 <span class="phrase"><a name="geometry.reference.algorithms.distance.distance_3_with_strategy.parameters"></a></span><a class="link" href="distance_3_with_strategy.html#geometry.reference.algorithms.distance.distance_3_with_strategy.parameters">Parameters</a> 58 </h6> 59<div class="informaltable"><table class="table"> 60<colgroup> 61<col> 62<col> 63<col> 64<col> 65</colgroup> 66<thead><tr> 67<th> 68 <p> 69 Type 70 </p> 71 </th> 72<th> 73 <p> 74 Concept 75 </p> 76 </th> 77<th> 78 <p> 79 Name 80 </p> 81 </th> 82<th> 83 <p> 84 Description 85 </p> 86 </th> 87</tr></thead> 88<tbody> 89<tr> 90<td> 91 <p> 92 Geometry1 const & 93 </p> 94 </td> 95<td> 96 <p> 97 Any type fulfilling a Geometry Concept 98 </p> 99 </td> 100<td> 101 <p> 102 geometry1 103 </p> 104 </td> 105<td> 106 <p> 107 A model of the specified concept 108 </p> 109 </td> 110</tr> 111<tr> 112<td> 113 <p> 114 Geometry2 const & 115 </p> 116 </td> 117<td> 118 <p> 119 Any type fulfilling a Geometry Concept 120 </p> 121 </td> 122<td> 123 <p> 124 geometry2 125 </p> 126 </td> 127<td> 128 <p> 129 A model of the specified concept 130 </p> 131 </td> 132</tr> 133<tr> 134<td> 135 <p> 136 Strategy const & 137 </p> 138 </td> 139<td> 140 <p> 141 Any type fulfilling a Distance Strategy Concept 142 </p> 143 </td> 144<td> 145 <p> 146 strategy 147 </p> 148 </td> 149<td> 150 <p> 151 The strategy which will be used for distance calculations 152 </p> 153 </td> 154</tr> 155</tbody> 156</table></div> 157<h6> 158<a name="geometry.reference.algorithms.distance.distance_3_with_strategy.h3"></a> 159 <span class="phrase"><a name="geometry.reference.algorithms.distance.distance_3_with_strategy.returns"></a></span><a class="link" href="distance_3_with_strategy.html#geometry.reference.algorithms.distance.distance_3_with_strategy.returns">Returns</a> 160 </h6> 161<p> 162 The calculated distance 163 </p> 164<h6> 165<a name="geometry.reference.algorithms.distance.distance_3_with_strategy.h4"></a> 166 <span class="phrase"><a name="geometry.reference.algorithms.distance.distance_3_with_strategy.header"></a></span><a class="link" href="distance_3_with_strategy.html#geometry.reference.algorithms.distance.distance_3_with_strategy.header">Header</a> 167 </h6> 168<p> 169 Either 170 </p> 171<p> 172 <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> 173 </p> 174<p> 175 Or 176 </p> 177<p> 178 <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">algorithms</span><span class="special">/</span><span class="identifier">distance</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></code> 179 </p> 180<h6> 181<a name="geometry.reference.algorithms.distance.distance_3_with_strategy.h5"></a> 182 <span class="phrase"><a name="geometry.reference.algorithms.distance.distance_3_with_strategy.available_strategies"></a></span><a class="link" href="distance_3_with_strategy.html#geometry.reference.algorithms.distance.distance_3_with_strategy.available_strategies">Available 183 Strategies</a> 184 </h6> 185<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 186<li class="listitem"> 187 <a class="link" href="../../strategies/strategy_distance_pythagoras.html" title="strategy::distance::pythagoras">Pythagoras 188 (cartesian)</a> 189 </li> 190<li class="listitem"> 191 <a class="link" href="../../strategies/strategy_distance_haversine.html" title="strategy::distance::haversine">Haversine 192 (spherical)</a> 193 </li> 194<li class="listitem"> 195 <a class="link" href="../../strategies/strategy_distance_cross_track.html" title="strategy::distance::cross_track">Cross 196 track (spherical, point-to-segment)</a> 197 </li> 198<li class="listitem"> 199 <a class="link" href="../../strategies/strategy_distance_projected_point.html" title="strategy::distance::projected_point">Projected 200 point (cartesian, point-to-segment)</a> 201 </li> 202<li class="listitem"> 203 more (currently extensions): Vincenty, Andoyer (geographic) 204 </li> 205</ul></div> 206</div> 207<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 208<td align="left"></td> 209<td align="right"><div class="copyright-footer">Copyright © 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam 210 Wulkiewicz, Oracle and/or its affiliates<p> 211 Distributed under the Boost Software License, Version 1.0. (See accompanying 212 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>) 213 </p> 214</div></td> 215</tr></table> 216<hr> 217<div class="spirit-nav"> 218<a accesskey="p" href="comparable_distance_2.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../distance.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="distance_2.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a> 219</div> 220</body> 221</html> 222