void computeCubicCoefficients(int n, double[][] C) {
      double[][] H = Geometry.Hermite;

      for (int j = 0 ; j < dd[n].length ; j++)
         vec[j] = dd[n+1][j] - dd[n][j];
      double cordLength = norm(vec, dd[n].length);

      double scale = 1.0;
      if (isFunction())
         scale = Math.max(0.25, Math.min(1.0, vec[0] / (Math.abs(vec[1]) + 0.01)));

      for (int j = 0 ; j < dd[n].length ; j++) {
         double scaleTangent = cordLength * 1.15;

	 switch (nRows) {
	 case 3: scaleTangent *= 1.20; break;
	 case 4: scaleTangent *= 1.15; break;
	 case 6: scaleTangent *= 0.95; break;
	 }

         if (isFunction())
            scaleTangent *= scale;

         double p0 = dd[n][j];
         double p1 = dd[n+1][j];

         double r0 = scaleTangent * ddd[n][j];
         double r1 = scaleTangent * ddd[n+1][j];

         for (int i = 0 ; i < 4 ; i++)
            C[j][i] = H[i][0] * p0 + H[i][1] * p1 + H[i][2] * r0 + H[i][3] * r1;
      }
   }