Interpolation/Cubic/Float - Second Life Wiki

Interpolation/Cubic/Float

From Second Life Wiki

Second Life Wiki > LSL Portal > Examples > Interpolation/Cubic/Float
Jump to: navigation, search

Contents

Summary

Function: float fCub( float a, float b, float c, float d, float t );

Cubic interpolation between four floating point values.
Returns a float

• float a
• float b
• float c
• float d
• float t

Specification

float fCub(float a, float b, float c, float d,float t) {
    float P = (d-c)-(a-b);
    return P*llPow(t,3) + ((a-b)-P)*llPow(t,2) + (c-a)*t + b;
}
// Released into public domain. By Nexii Malthus.

Examples

 

Deep Notes