interpolation/Cubic/Rotation
< Interpolation | Cubic
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation rCub( rotation a, rotation b, rotation c, rotation d, float t );
Spherical-Cubic interpolation between four rotations.
Returns a rotation
• rotation | a | – | Start | |
• rotation | b | – | End | |
• rotation | c | – | Affects path curve | |
• rotation | d | – | Affects path curve | |
• float | t |
Specification
<source lang="lsl2">rotation rCub(rotation a, rotation b, rotation c, rotation d, float t){
return rLin( rLin(a,b,t), rLin(c,d,t), 2*t*(1-t) );
} rotation rLin(rotation x, rotation y, float t) {
float ang = llAngleBetween(x, y); if(ang > PI) ang -= TWO_PI; return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*t);
} // Released into public domain. By Nexii Malthus.</source>
Examples
<source lang="lsl2"></source>