Introduced a new parameter "maxSegmentLength" which limits to interpolation to points whose distance is less than this param.