Description Usage Arguments Details Value Author(s) References Examples

View source: R/similarityMeasures.R

A function to calculate the Frechet distance between two trajectories. The function can also be used to test leash values.

1 | ```
Frechet(traj1, traj2, testLeash=-1)
``` |

`traj1` |
An m x n matrix containing trajectory1. Here m is the number of points and n is the dimension of the points. |

`traj2` |
A k x n matrix containing trajectory2. Here k is the number of points and n is the dimension of the points. The two trajectories are not required to have the same number of points. |

`testLeash` |
A numeric leash value, which if positive, checks whether the leash can be used between the two trajectories. If this value is negative, then it is not used and the standard calculation is performed. |

This algorithm calculates the Frechet distance. The Frechet metric (or distance) is generally described in the following way: A man is walking a dog on a leash, the man walks on one curve while the dog walks on the other (Alt & Godau, 1995). The dog and the man are able to vary their speeds, or even stop, but not go backwards. The Frechet metric is the minimum leash length required to complete the traversal of both curves. Please see the references for more information.

A floating point value representing the Frechet distance is returned. If a test leash is given, then a boolean value is returned as true if the leash was successful and false if not. If a problem occurs, then a string containing information about the problem is returned.

Kevin Toohey

Alt, H. and Godau, M. (1995) Computing the Frechet distance between two polygonal curves. *International Journal of Computational Geometry & Applications*, **5(01n02)**, 75–91.

1 2 3 4 5 6 |

```
[1] 4
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.