Calculating the length of a curve.