pathFrechet(P, Q, method = "max", Fdist = dist)
pathFrechetR(P, Q, method = "max", Fdist = dist)
inf_{a,b} max_{t} d(P(a(t)),Q(b(t)))
. It's computation is a
NP-complex problem. When P and Q are trajectories (discrete curve), the
problem is polynomial (and quite simple).
The Frechet distance can
also be define using a sum instead of a max: inf_{a,b} sum_{t} d(P(a(t)),Q(b(t)))
The Frechet path [...]
The function pathFrechetR
is code in R.
The function pathFrechet
is coded
in C (and is thus much faster than the two other). Note that
pathFrechet
(the fastest) can only use the "2D" and "1D" distance.P <- rnorm(7)
Q <- rnorm(6)
### Optimized function
pathFrechetR(P,Q)
### Function compiled in C
pathFrechet(P,Q)
### Frechet using sum instead of max.
pathFrechet(P,Q,method="sum")
### Frechet using "manhattan" distance
pathFrechetR(P,Q,Fdist=function(x)dist(x,method="manhattan"))
Run the code above in your browser using DataLab