new curve similarity

more stable curve matching algorithm