code: public static double BiCubicKernel(double x) {
          if (x < 0) {
              x = -x;
          }
  
          double biCoef = 0;
  
          if (x <= 1) {
              biCoef = (1.5 * x - 2.5) * x * x + 1;
          } else if (x < 2) {
              biCoef = ((-0.5 * x + 2.5) * x - 4) * x + 2;
          }
  
          return biCoef;
      }
docs: Bicubic kernel.
  <p>
  <para>The function implements bicubic kernel W(x) as described on
  http://en.wikipedia.org/wiki/Bicubic_interpolation#Bicubic_convolution_algorithm
  (coefficient <b>a</b> is set to <b>-0.5</b>).</para>
  
  @param x X value.
  @return Bicubic cooefficient.