Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / geometry / doc / html / geometry / reference / algorithms / discrete_frechet_distance / discrete_frechet_distance_2.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>discrete_frechet_distance</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&#160;1.&#160;Geometry">
8 <link rel="up" href="../discrete_frechet_distance.html" title="discrete_frechet_distance">
9 <link rel="prev" href="discrete_frechet_distance_3_with_strategy.html" title="discrete_frechet_distance (with strategy)">
10 <link rel="next" href="../discrete_hausdorff_distance.html" title="discrete_hausdorff_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="discrete_frechet_distance_3_with_strategy.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../discrete_frechet_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="../discrete_hausdorff_distance.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.discrete_frechet_distance.discrete_frechet_distance_2"></a><a class="link" href="discrete_frechet_distance_2.html" title="discrete_frechet_distance">discrete_frechet_distance</a>
28 </h5></div></div></div>
29 <p>
30             <a class="indexterm" name="idm46187002966288"></a>
31 Calculate discrete Frechet distance between two geometries (currently
32             work for LineString-LineString).
33           </p>
34 <h6>
35 <a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.h0"></a>
36             <span class="phrase"><a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.synopsis"></a></span><a class="link" href="discrete_frechet_distance_2.html#geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.synopsis">Synopsis</a>
37           </h6>
38 <p>
39 </p>
40 <pre class="programlisting"><span class="keyword">template</span><span class="special">&lt;</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">&gt;</span>
41 <span class="identifier">distance_result</span><span class="special">&lt;</span> <span class="keyword">typename</span> <span class="identifier">point_type</span><span class="special">&lt;</span><span class="identifier">Geometry1</span><span class="special">&gt;::</span><span class="identifier">type</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">point_type</span><span class="special">&lt;</span><span class="identifier">Geometry2</span><span class="special">&gt;::</span><span class="identifier">type</span> <span class="special">&gt;::</span><span class="identifier">type</span> <span class="identifier">discrete_frechet_distance</span><span class="special">(</span><span class="identifier">Geometry1</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">geometry1</span><span class="special">,</span> <span class="identifier">Geometry2</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">geometry2</span><span class="special">)</span></pre>
42 <p>
43           </p>
44 <h6>
45 <a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.h1"></a>
46             <span class="phrase"><a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.parameters"></a></span><a class="link" href="discrete_frechet_distance_2.html#geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.parameters">Parameters</a>
47           </h6>
48 <div class="informaltable"><table class="table">
49 <colgroup>
50 <col>
51 <col>
52 <col>
53 <col>
54 </colgroup>
55 <thead><tr>
56 <th>
57                     <p>
58                       Type
59                     </p>
60                   </th>
61 <th>
62                     <p>
63                       Concept
64                     </p>
65                   </th>
66 <th>
67                     <p>
68                       Name
69                     </p>
70                   </th>
71 <th>
72                     <p>
73                       Description
74                     </p>
75                   </th>
76 </tr></thead>
77 <tbody>
78 <tr>
79 <td>
80                     <p>
81                       Geometry1 const &amp;
82                     </p>
83                   </td>
84 <td>
85                     <p>
86                       Any type fulfilling a Geometry Concept
87                     </p>
88                   </td>
89 <td>
90                     <p>
91                       geometry1
92                     </p>
93                   </td>
94 <td>
95                     <p>
96                       Input geometry
97                     </p>
98                   </td>
99 </tr>
100 <tr>
101 <td>
102                     <p>
103                       Geometry2 const &amp;
104                     </p>
105                   </td>
106 <td>
107                     <p>
108                       Any type fulfilling a Geometry Concept
109                     </p>
110                   </td>
111 <td>
112                     <p>
113                       geometry2
114                     </p>
115                   </td>
116 <td>
117                     <p>
118                       Input geometry
119                     </p>
120                   </td>
121 </tr>
122 </tbody>
123 </table></div>
124 <h6>
125 <a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.h2"></a>
126             <span class="phrase"><a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.header"></a></span><a class="link" href="discrete_frechet_distance_2.html#geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.header">Header</a>
127           </h6>
128 <p>
129             Either
130           </p>
131 <p>
132             <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">hpp</span><span class="special">&gt;</span></code>
133           </p>
134 <p>
135             Or
136           </p>
137 <p>
138             <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">algorithms</span><span class="special">/</span><span class="identifier">discrete_frechet_distance</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
139           </p>
140 <h6>
141 <a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.h3"></a>
142             <span class="phrase"><a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.behavior"></a></span><a class="link" href="discrete_frechet_distance_2.html#geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.behavior">Behavior</a>
143           </h6>
144 <p>
145             The algorithm calculate discrete frechet distance between two geometries.
146           </p>
147 <div class="note"><table border="0" summary="Note">
148 <tr>
149 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../../../doc/src/images/note.png"></td>
150 <th align="left">Note</th>
151 </tr>
152 <tr><td align="left" valign="top"><p>
153               The units of the distance depends on strategy. In order to change the
154               default behavior a user has to create a strategy and pass it explicitly
155               into the algorithm.
156             </p></td></tr>
157 </table></div>
158 <h6>
159 <a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.h4"></a>
160             <span class="phrase"><a name="geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.example"></a></span><a class="link" href="discrete_frechet_distance_2.html#geometry.reference.algorithms.discrete_frechet_distance.discrete_frechet_distance_2.example">Example</a>
161           </h6>
162 <p>
163             Calculate Similarity between two geometries as the discrete frechet distance
164             between them.
165           </p>
166 <p>
167 </p>
168 <pre class="programlisting"><span class="preprocessor">#include</span> <span class="special">&lt;</span><span class="identifier">iostream</span><span class="special">&gt;</span>
169
170 <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>
171 <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>
172 <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">linestring</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span>
173
174 <span class="keyword">int</span> <span class="identifier">main</span><span class="special">()</span>
175 <span class="special">{</span>
176     <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</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">point_type</span><span class="special">;</span>
177     <span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">model</span><span class="special">::</span><span class="identifier">linestring</span><span class="special">&lt;</span><span class="identifier">point_type</span><span class="special">&gt;</span> <span class="identifier">linestring_type</span><span class="special">;</span>
178
179     <span class="identifier">linestring_type</span> <span class="identifier">ls1</span><span class="special">,</span> <span class="identifier">ls2</span><span class="special">;</span>
180     <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"LINESTRING(0 0,1 1,1 2,2 1,2 2)"</span><span class="special">,</span> <span class="identifier">ls1</span><span class="special">);</span>
181     <span class="identifier">boost</span><span class="special">::</span><span class="identifier">geometry</span><span class="special">::</span><span class="identifier">read_wkt</span><span class="special">(</span><span class="string">"LINESTRING(1 0,0 1,1 1,2 1,3 1)"</span><span class="special">,</span> <span class="identifier">ls2</span><span class="special">);</span>
182
183     <span class="keyword">double</span> <span class="identifier">res</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">discrete_frechet_distance</span><span class="special">(</span><span class="identifier">ls1</span><span class="special">,</span> <span class="identifier">ls2</span><span class="special">);</span>
184
185     <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="string">"Discrete Frechet Distance: "</span> <span class="special">&lt;&lt;</span> <span class="identifier">res</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>
186
187     <span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
188 <span class="special">}</span>
189 </pre>
190 <p>
191           </p>
192 <p>
193             Output:
194           </p>
195 <pre class="programlisting">Discrete Frechet Distance:  1.41421
196 </pre>
197 </div>
198 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
199 <td align="left"></td>
200 <td align="right"><div class="copyright-footer">Copyright &#169; 2009-2019 Barend Gehrels, Bruno Lalande, Mateusz Loskot, Adam
201       Wulkiewicz, Oracle and/or its affiliates<p>
202         Distributed under the Boost Software License, Version 1.0. (See accompanying
203         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>)
204       </p>
205 </div></td>
206 </tr></table>
207 <hr>
208 <div class="spirit-nav">
209 <a accesskey="p" href="discrete_frechet_distance_3_with_strategy.html"><img src="../../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../discrete_frechet_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="../discrete_hausdorff_distance.html"><img src="../../../../../../../../doc/src/images/next.png" alt="Next"></a>
210 </div>
211 </body>
212 </html>