Extrapolation

This setting is based on the assumption that the movement beyond the segment boundaries would continue uniformly, i.e. along the straight line through the respective points. This results in the following derivatives at the margins:

y'(P[0].X) = (P[1].Y - P[0].Y) / (P[1].X - P[0].X])

(gradient in P[0] = gradient of the straight line through P[0] and P[1])

y'(P[n].X) = (P[n].Y - P[n-1].Y) / (P[n].X - P[n-1].X])

(gradient in P[n] = gradient of the straight line through P[n-1] and P[n])

The following figure illustrates the procedure: