We Recommend

C++ The Core Language C++ The Core Language
C++: The Core Language is for C programmers transitioning to C++. It's designed to get readers up to speed quickly by covering an essential subset of the language. The subset consists of features without which it's just not C++, and a handful of others that make it a reasonably useful language.


Posted By

yuconner on 08/03/06


Tagged

math interpolation


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

rolandog
yuconner
copyleft


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.