====== Toolbox functions ====== ===== Clamp ===== **Definition**: min(max(f,a),b) **Call**: hfA_Clamp(f,a,b); **Parameters**: f : real value (to be clamped)\\ a : lower boundary of the interval\\ b : upper boundary of the interval ===== Step ===== **Definition**: if f1) t = 1 \\ c2 = (1-t)*c0+t*(c1) **Call**: hfA_Lerp(c2,c1,c0,xt,x1,x0) **Parameters**: \\ xt - point coordinate \\ x0,x1 - Interval in between the interpolation is done \\ c0,c1 - Input array \\ **Output**: \\ c2 : array of values (linear interpolation of c0 and c1) **Test file**: [[http://www.hyperfun.org/HF2/Language/Library/Attri_Lib/hffiles/hfA_Lerp.hf|hfA_Lerp.hf]] ===== Cubic interpolation ===== {{http://www.hyperfun.org/HF2/Language/Library/Attri_Lib/images/hfA_Cerp.JPG?200x200&nolink}} \\ **Definition**: t = 3xt^2-2xt^2. with xt in [x0,x1] \\ if(t<0) t = 0 \\ if(t>0) t = 1 \\ c2 = (1-t)*c0+t*(c1) **Call**: hfA_Cerp(c2,c1,c0,xt,x1,x0) **Parameters**: \\ xt - point coordinate \\ x0,x1 - Interval in between the interpolation is done \\ c0,c1 - Input array \\ **Output**: \\ c2 : array of values (linear interpolation of c0 and c1) **Test file**: [[http://www.hyperfun.org/HF2/Language/Library/Attri_Lib/hffiles/hfA_Cerp.hf|hfA_Cerp.hf]] ===== Spline Interpolation ===== {{http://www.hyperfun.org/HF2/Language/Library/Attri_Lib/images/hfA_spline.JPG?200x200&nolink}} \\ **Definition**: Given an array of 3*n values (in the case of rgb attributes), and given an interval [t0,t1], a spline interpolation is performed to obtain the resulting set of attributes **Call**: HFA_Spline(s,c,t,t0,t1) **Parameters**: \\ s - Output array (attributes) \\ c - Input array (attributes) \\ t - Real value \\ t0,t1 - Real values, interval \\ **Output**: \\ s : array of values (attributes) interpolated from the array c **Test file**: [[http://www.hyperfun.org/HF2/Language/Library/Attri_Lib/hffiles/HFA_Spline.hf|HFA_Spline.hf]]