This computes the derivative at key, as a weighted average of the linear slopes into and out of key, the weights being determined by the tension and continuity
"ds" is the "source derivative", or "arriving derivative"
"dd" is the "destination derivative" or "departing derivative"