I\'m trying to implement a function for calculating "minimum integral square error" that takes the distance of two vertices of a polyline measured along the polyli