Difference between revisions of "Interpolation/Linear/Vector"
< Interpolation | Linear
Jump to navigation
Jump to search
m |
m (<lsl> tag to <source>) |
||
Line 9: | Line 9: | ||
|func_desc= | |func_desc= | ||
Interpolates between two vector values in a linear fashion. | Interpolates between two vector values in a linear fashion. | ||
|spec=< | |spec=<source lang="lsl2">vector vLin(vector x, vector y, float t){ | ||
return x*(1-t) + y*t; | return x*(1-t) + y*t; | ||
} | } | ||
// Released into public domain. By Nexii Malthus.</ | // Released into public domain. By Nexii Malthus.</source> | ||
|examples=< | |examples=<source lang="lsl2"> | ||
vector x = <-5, 1, 10>; | vector x = <-5, 1, 10>; | ||
vector y = <15, 2, 2>; | vector y = <15, 2, 2>; | ||
vector z = vLin(x, y, 0.6); // z == <7, 1.6, 5.2></ | vector z = vLin(x, y, 0.6); // z == <7, 1.6, 5.2></source> | ||
|cat1=Examples | |cat1=Examples | ||
}} | }} |
Latest revision as of 15:05, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector vLin( vector x, vector y, float t );
Interpolates between two vector values in a linear fashion.
Returns a vector
• vector | x | |||
• vector | y | |||
• float | t |
Specification
vector vLin(vector x, vector y, float t){
return x*(1-t) + y*t;
}
// Released into public domain. By Nexii Malthus.
Examples
vector x = <-5, 1, 10>;
vector y = <15, 2, 2>;
vector z = vLin(x, y, 0.6); // z == <7, 1.6, 5.2>