Difference between revisions of "Interpolation/Cosine"
Jump to navigation
Jump to search
m |
m |
||
Line 24: | Line 24: | ||
|- | |- | ||
| float f0 | | float f0 | ||
| Start | | Start (t = 0.0) | ||
|- | |- | ||
| float f1 | | float f1 | ||
| End | | End (t = 1.0) | ||
|- | |- | ||
| float t | | float t | ||
Line 64: | Line 64: | ||
|- | |- | ||
| vector v0 | | vector v0 | ||
| Start | | Start (t = 0.0) | ||
|- | |- | ||
| vector v1 | | vector v1 | ||
| End | | End (t = 1.0) | ||
|- | |- | ||
| float t | | float t | ||
Line 109: | Line 109: | ||
|- | |- | ||
| rotation r0 | | rotation r0 | ||
| Start | | Start (t = 0.0) | ||
|- | |- | ||
| rotation r1 | | rotation r1 | ||
| End | | End (t = 1.0) | ||
|- | |- | ||
| float t | | float t |
Revision as of 13:42, 4 September 2011
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials | Interpolation |
Linear Interpolation
Float Cosine | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Cosine interpolation of f0 and f1 with fraction t. <lsl> float fCos(float f0,float f1,float t) { float F = (1 - llCos(t*PI))/2; return f0*(1-F)+f1*F; } </lsl>
Released to Public Domain. By Nexii Malthus
|
Vector Cosine | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Cosine interpolation of v0 and v1 with fraction t. <lsl> vector vCos(vector v0,vector v1,float t){ float F = (1 - llCos(t*PI))/2; return v0*(1-F)+v1*F;} </lsl>
Released to Public Domain. By Nexii Malthus
|
Rotation Cosine | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Spherical Cosine interpolation of r0 and r1 with fraction t. I liken to call it as SCORP <lsl> rotation rCos(rotation r0,rotation r1,float t){ // Spherical-Cosine Interpolation float f = (1 - llCos(t*PI))/2; float ang = llAngleBetween(r0, r1); if( ang > PI) ang -= TWO_PI; return r0 * llAxisAngle2Rot( llRot2Axis(r1/r0)*r0, ang*f);} </lsl>
Released to Public Domain. By Nexii Malthus
|