addon/utils/shadow/line-interpolation/monotone.js
function d3_svg_lineHermite(points, tangents) {
  if (tangents.length < 1 || (points.length !== tangents.length && points.length !== tangents.length + 2)) {
    return points;
  }

  var quad = points.length !== tangents.length,
      commands = [],
      p0 = points[0],
      p = points[1],
      t0 = tangents[0],
      t = t0,
      pi = 1;

  if (quad) {
    commands.push([
      p[0] - t0[0] * 2 / 3,
      p[1] - t0[1] * 2 / 3,
      p[0],
      p[1]
    ]);
    p0 = points[1];
    pi = 2;
  }

  if (tangents.length > 1) {
    t = tangents[1];
    p = points[pi];
    pi++;
    commands.push([
      p0[0] + t0[0],
      p0[1] + t0[1],
      p[0] - t[0],
      p[1] - t[1],
      p[0],
      p[1]
    ]);

    for (var i = 2; i < tangents.length; i++, pi++) {
      p = points[pi];
      t = tangents[i];
      let lt = tangents[i - 1];
      let lp = points[i - 1];

      commands.push([
        lp[0] + lt[0], // Add the last tangent but reflected
        lp[1] + lt[1],
        p[0] - t[0],
        p[1] - t[1],
        p[0],
        p[1]
      ]);
    }
  }

  if (quad) {
    var lp = points[pi];
    commands.push([
      p[0] + t[0] * 2 / 3,
      p[1] + t[1] * 2 / 3,
      lp[0],
      lp[1]
    ]);
  }

  return commands;
}
function d3_svg_lineHermite(points, tangents) {
  if (tangents.length < 1 || (points.length !== tangents.length && points.length !== tangents.length + 2)) {
    return points;
  }

  var quad = points.length !== tangents.length,
      commands = [],
      p0 = points[0],
      p = points[1],
      t0 = tangents[0],
      t = t0,
      pi = 1;

  if (quad) {
    commands.push([
      p[0] - t0[0] * 2 / 3,
      p[1] - t0[1] * 2 / 3,
      p[0],
      p[1]
    ]);
    p0 = points[1];
    pi = 2;
  }

  if (tangents.length > 1) {
    t = tangents[1];
    p = points[pi];
    pi++;
    commands.push([
      p0[0] + t0[0],
      p0[1] + t0[1],
      p[0] - t[0],
      p[1] - t[1],
      p[0],
      p[1]
    ]);

    for (var i = 2; i < tangents.length; i++, pi++) {
      p = points[pi];
      t = tangents[i];
      let lt = tangents[i - 1];
      let lp = points[i - 1];

      commands.push([
        lp[0] + lt[0], // Add the last tangent but reflected
        lp[1] + lt[1],
        p[0] - t[0],
        p[1] - t[1],
        p[0],
        p[1]
      ]);
    }
  }

  if (quad) {
    var lp = points[pi];
    commands.push([
      p[0] + t[0] * 2 / 3,
      p[1] + t[1] * 2 / 3,
      lp[0],
      lp[1]
    ]);
  }

  return commands;
}
function d3_svg_lineHermite ( points , tangents ) { if ( tangents . length < 1 || ( points . length !== tangents . length && points . length !== tangents . length + 2 ) ) { return points ; } var quad = points . length !== tangents . length , commands = [ ] , p0 = points [ 0 ] , p = points [ 1 ] , t0 = tangents [ 0 ] , t = t0 , pi = 1 ; if ( quad ) { commands . push ( [ p [ 0 ] - t0 [ 0 ] * 2 / 3 , p [ 1 ] - t0 [ 1 ] * 2 / 3 , p [ 0 ] , p [ 1 ] ] ) ; p0 = points [ 1 ] ; pi = 2 ; } if ( tangents . length > 1 ) { t = tangents [ 1 ] ; p = points [ pi ] ; pi ++ ; commands . push ( [ p0 [ 0 ] + t0 [ 0 ] , p0 [ 1 ] + t0 [ 1 ] , p [ 0 ] - t [ 0 ] , p [ 1 ] - t [ 1 ] , p [ 0 ] , p [ 1 ] ] ) ; for ( var i = 2 ; i < tangents . length ; i ++ , pi ++ ) { p = points [ pi ] ; t = tangents [ i ] ; let lt = tangents [ i - 1 ] ; let lp = points [ i - 1 ] ; commands . push ( [ lp [ 0 ] + lt [ 0 ] , // Add the last tangent but reflected lp [ 1 ] + lt [ 1 ] , p [ 0 ] - t [ 0 ] , p [ 1 ] - t [ 1 ] , p [ 0 ] , p [ 1 ] ] ) ; } } if ( quad ) { var lp = points [ pi ] ; commands . push ( [ p [ 0 ] + t [ 0 ] * 2 / 3 , p [ 1 ] + t [ 1 ] * 2 / 3 , lp [ 0 ] , lp [ 1 ] ] ) ; } return commands ; }
Hermite spline construction; generates "C" commands.
Hermite spline construction ; generates C commands .