Interpolation/Cosine/Vector: Difference between revisions
< Interpolation | Cosine
Created page with "{{LSL_Function |mode=user |func=fCos |p1_type=vector|p1_name=x |p2_type=vector|p2_name=y |p3_type=float|p3_name=t |return_type=vector |return_value=returns the interpolation betw…" |
m Replace <nowiki> & <source> with <syntaxhighlight> |
||
| (One intermediate revision by one other user not shown) | |||
| Line 9: | Line 9: | ||
|func_desc= | |func_desc= | ||
Cosine interpolation between two vectors. | Cosine interpolation between two vectors. | ||
|spec=< | |spec=<syntaxhighlight lang="lsl2"> | ||
vector vCos(float x, float y, float t) { | |||
float F = (1-llCos(t*PI))/2; | float F = (1-llCos(t*PI))/2; | ||
return x*(1-F)+y*F; | return x*(1-F)+y*F; | ||
} | } | ||
// Released into public domain. By Nexii Malthus.</ | // Released into public domain. By Nexii Malthus.</syntaxhighlight> | ||
|examples=< | |examples=<syntaxhighlight lang="lsl2"></syntaxhighlight> | ||
|cat1=Examples | |cat1=Examples | ||
}} | }} | ||
Latest revision as of 16:20, 6 May 2025
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector fCos( vector x, vector y, float t );
Cosine interpolation between two vectors.
Returns a vector
| • vector | x | |||
| • vector | y | |||
| • float | t |
Specification
vector vCos(float x, float y, float t) {
float F = (1-llCos(t*PI))/2;
return x*(1-F)+y*F;
}
// Released into public domain. By Nexii Malthus.
Examples