interpolation/Linear/Vectors
< Interpolation | Linear
Jump to navigation
Jump to search
Revision as of 02:35, 14 September 2011 by Nexii Malthus (talk | contribs) (Created page with "{{LSL_Function |mode=user |func=vLin |p1_type=list|p1_name=v |p2_type=float|p2_name=t |p3_type=integer|p3_name=Loop |return_type=vector |return_value=returns the interpolation of…")
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector vLin( list v, float t, integer Loop );
Linearly interpolates between two vector points in a list of vectors that define a path.
Returns a vector
• list | v | |||
• float | t | |||
• integer | Loop |
Specification
<lsl>vector pLin(list v, float t, integer Loop){
float l = llGetListLength(v); t *= l-1; float f = (float)llFloor(t); integer i1 = 0; integer i2 = 0; if(Loop){ i1 = (integer)(f-llFloor(f/l)*l); ++f;i2 = (integer)(f-llFloor(f/l)*l); } else { if( f > l-1 ) i1 = (integer)l-1; else if( f >= 0 ) i1 = (integer)f; if(f+1 > l-1 ) i2 = (integer)l-1; else if(f+1 >= 0 ) i2 = (integer)f+1; } vector v1 = llList2Vector(v, i1); vector v2 = llList2Vector(v, i2); t-=f; return v1*(1-t) + v2*t;
}</lsl>
Examples
<lsl></lsl>