var Spline = require('./spline');

var Cubic = Spline.extend({
  constructor: function() {
    Spline.apply(this, arguments);
    this.degree = Cubic.degree;
  },
  coeff: function coeff(segment, n, dir) {
    var curr = segment,
        next = segment + 1,
        r0 = this.pos(curr, dir),
        r1 = this.pos(next, dir),
        v0 = this.vel(curr, dir),
        v1 = this.vel(next, dir, true),
        t0 = this.par(curr),
        t1 = this.par(next),
        td = t1 - t0;
    switch(n) {
      case 0: return r0;
      case 1: return v0;
      case 2: return 3*(r1-r0)/td/td - (v1+2*v0)/td;
      case 3: return 2*(r0-r1)/td/td/td + (v1+v0)/td/td;
    }
  },
});

Cubic.degree = 3;

module.exports = Cubic;

@@ -28,16 +28,77 @@
 ine');%0A%0A
+/**%0A * The cubic spline is made from 3rd degree polynoms%0A */%0A
 var Cubi
@@ -217,16 +217,111 @@
 e;%0A  %7D,%0A
+  /**%0A   * Get the %60n%60th coefficient for the %60segment%60th segment%0A   * in %60dir%60 dimension%0A   */%0A
   coeff:

Add some docs to cubic spline