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 f<a return 0 else return 1

Call: hfA_Step(f,a);

Parameters:

f : real value a : real value

Pulse

www.hyperfun.org_hf2_language_library_attri_lib_images_hfa_pulse.jpg Definition: step(f,a)-step(b,f)

Call: hfA_Pulse(f,a,b);

Parameters:

f : real value a : real value b : real value

Test file: hfA_Pulse.hf

Smooth Step

Definition: Mapping a value f to [0,1], with a smooth interpolation of ‘s’ between [smin,smax]

Call: hfA_SmoothStep(s,smin,smax,f,fmin,fmax);

Parameters:

s : real value smin : real value smax : real value f : real value fmin : real value fmax : real value

Output: f - value between [0,1], s - value between [smin, smax]

Modulo

www.hyperfun.org_hf2_language_library_attri_lib_images_hfa_modulo.jpg Definition: a%b

Call: hfA_Modulo(a,b);

Parameters:

a : lower boundary of the interval b : upper boundary of the interval

Test file: hfA_Modulo.hf

Floor

Definition: integer part of ‘a’

Call: hfA_Floor(a);

Parameters:

a : real value

Linear Interpolation

www.hyperfun.org_hf2_language_library_attri_lib_images_hfa_lerp.jpg
Definition: t = (xt-x0)(x1-x0)
if(t<0) t = 0
if(t>1) 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: hfA_Lerp.hf

Cubic interpolation

www.hyperfun.org_hf2_language_library_attri_lib_images_hfa_cerp.jpg
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: hfA_Cerp.hf

Spline Interpolation

www.hyperfun.org_hf2_language_library_attri_lib_images_hfa_spline.jpg
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: HFA_Spline.hf

hyperfun/lib_attrtoolbox.txt · Last modified: 2008/12/11 10:07 by admin
This site contains HyperFun and other software that is free to use and modify under the provisions of the CGPL agreement unless otherwise stated.
Project hosted by the Digital Materialization Group
HyperFun CGPL Creative Commons License Valid CSS