Difference between revisions of "Interpolation/Hermite/Float"
< Interpolation | Hermite
Jump to navigation
Jump to search
(Created page with "{{LSL_Function |mode=user |func=fHem |p1_type=float|p1_name=a |p2_type=float|p2_name=b |p3_type=float|p3_name=c |p4_type=float|p4_name=d |p5_type=float|p5_name=t |p6_type=float|p…") |
m (<lsl> tag to <source>) |
||
Line 13: | Line 13: | ||
|func_desc= | |func_desc= | ||
Hermite interpolation of floating points a, b, c and d with fraction t, tension and bias. | Hermite interpolation of floating points a, b, c and d with fraction t, tension and bias. | ||
|spec=< | |spec=<source lang="lsl2">float fHem(float a, float b, float c, float d, float t, float tens, float bias){ | ||
float t2 = t*t;float t3 = t2*t; | float t2 = t*t;float t3 = t2*t; | ||
float a0 = (b-a)*(1+bias)*(1-tens)/2; | float a0 = (b-a)*(1+bias)*(1-tens)/2; | ||
Line 25: | Line 25: | ||
return b0 * b + b1 * a0 + b2 * a1 + b3 * c; | return b0 * b + b1 * a0 + b2 * a1 + b3 * c; | ||
} | } | ||
// Released into public domain. By Nexii Malthus.</ | // Released into public domain. By Nexii Malthus.</source> | ||
|examples=< | |examples=<source lang="lsl2"></source> | ||
|cat1=Examples | |cat1=Examples | ||
}} | }} |
Latest revision as of 16:03, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: float fHem( float a, float b, float c, float d, float t, float tens, float bias );
Hermite interpolation of floating points a, b, c and d with fraction t, tension and bias.
Returns a float
• float | a | |||
• float | b | |||
• float | c | |||
• float | d | |||
• float | t | |||
• float | tens | |||
• float | bias |
Specification
float fHem(float a, float b, float c, float d, float t, float tens, float bias){
float t2 = t*t;float t3 = t2*t;
float a0 = (b-a)*(1+bias)*(1-tens)/2;
a0 += (c-b)*(1-bias)*(1-tens)/2;
float a1 = (c-b)*(1+bias)*(1-tens)/2;
a1 += (d-c)*(1-bias)*(1-tens)/2;
float b0 = 2*t3 - 3*t2 + 1;
float b1 = t3 - 2*t2 + t;
float b2 = t3 - t2;
float b3 = -2*t3 + 3*t2;
return b0 * b + b1 * a0 + b2 * a1 + b3 * c;
}
// Released into public domain. By Nexii Malthus.
Examples