Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Now,I have a lot of curves presented by discrete points,each curve is a aspect of real world data.And I want to do curve match using Fréchet Distance and I will do it by C#,but I don't know how to do it.I have a little knowledge about Fréchet Distance,but not so clear.Is there anyone can offer me some really good materials(I have seen a lot,but I think I need step by step tutorial) or tell me some C# libraries I can use? I'll appreciate it.
My English is not really good,so I would be really sorry if I made mistakes in grammar.
Posted
Updated 29-Feb-16 16:04pm

This is not such a simple thing which can be explained in a single or few Quick Answers in this forum. You can develop the code from the definition. This is explained here:
http://en.wikipedia.org/wiki/Fr%C3%A9chet_distance[^].

I would not expect a ready-to-use solution. However, this search gives some hopeful links: http://bit.ly/1c0dX8Q[^].

You should not search for C# only. If you can hope to find a robust solution in any language, translating it to C# would be way easier than writing if from scratch.

—SA
 
Share this answer
 
Comments
Mehdi Gholam 1-Oct-13 9:24am    
I was going to say it sounded like homework, 5'ed anyway.
Sergey Alexandrovich Kryukov 1-Oct-13 9:29am    
Thank you, Mehdi.
I don't know if this a homework or not. If it's a homework, it's a pretty difficult one.
—SA
Jacory Gao 2-Oct-13 3:32am    
I'm in China,and our goverment have some restrictions on the internet,so,I can't open the second website you offered.Could you save it in HTML format and send it to me?Anyway,Thank you very much!
Sergey Alexandrovich Kryukov 2-Oct-13 4:16am    
Wow!.. I'm sorry but it shows over 87,000 links, so it is intended only for interactive use.
Even if I select some most relevant ones by my own, how could I be sure that you would be able to load those pages?
However, about my last link: care to try again? Few minutes ago I could not load that page, but later it worked out; could be an intermittent problem. Or did you get an explicit message from the Great Chinese Firewall?
—SA
Jacory Gao 2-Oct-13 12:30pm    
I have figure this problem out and used some technology to open that website,and find a almost perfect solution about Frechet Distance.A little hard,but,finally I learned how to do that computation.Thank you anyway.
I put my matlab code here.

C#
function distance=FrechetDistance(p1,n,p2,m);
  tempdis(m,n)=0;
  distance=Cal(p1,p2,tempdis,m-1,n-1)
end

function tempdis=Cal(p1,p2,i,j);
if tempdis[i,j] > -1.0
    tepdis=tempdis[i,j];
end
elseif i == 0 && j == 0
        tempdis[i,j] = Dis(p1,p2,0,0);
    end
    elseif i>0&&j==0
        tempdis[i,j] = max([Cal(p1,p2,tempdis,i-1,0),Dis(p1,p2,i,0)])
        end
        elseif i==0&&j>0
            tempdis[i,j] = max([Cal(p1,p2,tempdis,0,j-1),Dis(p1,p2,0,j)])
            end
            elseif
                tempdis[i,j] = max([min([Cal(p1,p2,tempdis,i-1,j),Cal(p1,p2,tempdis,i-1,j-1),Cal(p1,p2,tempdis,i,j-1)]),Dis(p1,p2,i,j)])
                end
                else
                    tempdis[i,j] = 9999999
                    end
end

function dis=Dis(p1,p2,i,j);
  dis=Sqrt((p1[0,j]-p2[0,i])^2 + (p1[1,j]-p2[1,i])^2);
end
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900