The function implements bicubic kernel W(x) as described on Wikipedia (coefficient a is set to -0.5).
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; } }