Deprecated: Caller from MathObject::readFromCache ignored an error originally raised from MathObject::readFromCache: [1054] Unknown column 'math_mathml' in 'field list' in /var/www/html/includes/debug/MWDebug.php on line 385
Deprecated: Caller from LCStoreDB::get ignored an error originally raised from MathObject::readFromCache: [1054] Unknown column 'math_mathml' in 'field list' in /var/www/html/includes/debug/MWDebug.php on line 385 Option type - formulasearchengine
Option type
From formulasearchengine
Revision as of 12:00, 5 October 2013 by en>Nbarth(nullable)
Smoothstep is a scalar interpolation function commonly used in computer graphics[1][2] and video game engines.[3] The function interpolates smoothly between two input values based on a third one that should be between the first two. The returned value is clamped between 0 and 1.
The slope of the smoothstep function tends toward zero at both edges. This makes it easy to create a sequence of transitions using smoothstep to interpolate each segment rather than using a more sophisticated or expensive interpolation technique.
An example implementation provided by AMD[4] follows.
floatsmoothstep(floatedge0,floatedge1,floatx){// Scale, bias and saturate x to 0..1 rangex=saturate((x-edge0)/(edge1-edge0));// Evaluate polynomialreturnx*x*(3-2*x);}
Ken Perlin suggests[5] an improved version of the smoothstep function which has zero 1st and 2nd order derivatives at t=0 and t=1:
Reference implementation:
floatsmootherstep(floatedge0,floatedge1,floatx){// Scale, and clamp x to 0..1 rangex=clamp((x-edge0)/(edge1-edge0),0.0,1.0);// Evaluate polynomialreturnx*x*x*(x*(x*6-15)+10);}
Origin
3rd order equation
We start with a generic third order polynomial function and its first derivative:
Applying the desired values for the function at both endpoints we get:
Applying the desired values for the first derivative of the function at both endpoints we get:
Solving the system of 4 unknowns formed by the last 4 equations we obtain the values of the polynomial coefficients:
Introducing these coefficients back into the first equation gives the third order smoothstep function:
5th order equation
We start with a generic fifth order polynomial function, its first derivative and its second derivative:
Applying the desired values for the function at both endpoints we get:
Applying the desired values for the first derivative of the function at both endpoints we get:
Applying the desired values for the second derivative of the function at both endpoints we get:
Solving the system of 6 unknowns formed by the last 6 equations we obtain the values of the polynomial coefficients:
Introducing these coefficients back into the first equation gives the fifth order smoothstep function:
References
43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.