   Error in Bicubic Interpolation algorithm
  Hi there,I'm implementing a bicubic interpolation algorithm that maps textures in a ray tracer. I'm using the algorithm as described in this post:http://www.gamedev.net/community/forums/topic.asp?topic_id=336744&whichpage=1#2197591which seems very straightforward to me, and the results look great. However, for some values, the 'cubic' function returns values outside the input values, which should not be possible, but I'm unable to figure out what is wrong. Can anybody help me out and have a look at that function?I'll duplicate it here for convenience. A combination that returns a negative value is 254,8,8,8 and 0.3:   public static float Cubic(int v0, int v1, int v2, int v3, float t)   {  int p = (v3 - v2) - (v0 - v1);  int q = (v0 - v1) - p;  int r = v2 - v0;  int s = v1;  float tSqrd = t * t;  return (p * (tSqrd * t)) + (q * tSqrd) + (r * t) + s;   }
  I'm not a math genius, but isn't this expected for cubic interpolation? With the step from 254 to 8, you'll get a very steep tangent at v1, so the interpolated value will first sweep downward a bit from v1 before catching up and aiming for v2 again.Are you by any chance mixing this up with quadratic interpolation?Quadratic interpolation would be guaranteed to stay between the left and right interpolated values because it doesn't use tangents.    public static float quadraticInterpolate(float a, float b, float t) { float t2 = t * t; float t3 = t2 * t; return a * (2 * t3 - 3 * t2 + 1) + b * (3 * t2 - 2 * t3);    };  This is expected.http://en.wikipedia.org/wiki/Bicubic_interpolation#Use_in_computer_graphicsQuote:Bicubic interpolation causes overshoot, which increases acutance.