function to measure length of track from given vertex