Difference between revisions of "Interpolation/Linear/Float"
< Interpolation | Linear
Jump to navigation
Jump to search
(Created page with "{{LSL_Function |mode=user |func=fLin |p1_type=float|p1_name=x |p2_type=float|p2_name=y |p3_type=float|p3_name=t |return_type=float |return_value=returns the interpolation between…") |
m (<lsl> tag to <source>) |
||
(One intermediate revision by one other user not shown) | |||
Line 9: | Line 9: | ||
|func_desc=[[Image:Interp_Chart1.png|frame|right]] | |func_desc=[[Image:Interp_Chart1.png|frame|right]] | ||
Interpolates between two floating point values in a linear fashion. | Interpolates between two floating point values in a linear fashion. | ||
|spec=< | |spec=<source lang="lsl2">float fLin(float x, float y, float t) { | ||
return x*(1-t) + y*t; | return x*(1-t) + y*t; | ||
}</ | } | ||
|examples=< | // Released into public domain. By Nexii Malthus.</source> | ||
|examples=<source lang="lsl2">float value = fLin(-5, 15, 0.6); // value == 7</source> | |||
|cat1=Examples | |cat1=Examples | ||
}} | }} |
Latest revision as of 16:04, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Specification
float fLin(float x, float y, float t) {
return x*(1-t) + y*t;
}
// Released into public domain. By Nexii Malthus.
Examples
float value = fLin(-5, 15, 0.6); // value == 7