Posted By

yuconner on 08/03/06


Tagged

math interpolation


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

rolandog
yuconner
copyleft
khouser


cubic interpolation


 / Published in: C++
 

  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  

You need to login to post a comment.