interpolation/Cubic/Rotation
< Interpolation | Cubic
Jump to navigation
Jump to search
Revision as of 15:02, 24 January 2015 by ObviousAltIsObvious Resident (talk | contribs) (<lsl> tag to <source>)
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
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.
Examples