cubic interpolation


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. float cubic_interpolate( float y0, float y1, float y2, float y3, float mu ) {
  2.  
  3. float a0, a1, a2, a3, mu2;
  4.  
  5. mu2 = mu*mu;
  6. a0 = y3 - y2 - y0 + y1; //p
  7. a1 = y0 - y1 - a0;
  8. a2 = y2 - y0;
  9. a3 = y1;
  10.  
  11. return ( a0*mu*mu2 + a1*mu2 + a2*mu + a3 );
  12. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.