calculate length of trackSegment