Difference between revisions of "Interpolation/Cosine/Rotation"
< Interpolation | Cosine
Jump to navigation
Jump to search
(Created page with "{{LSL_Function |mode=user |func=rCos |p1_type=rotation|p1_name=x |p2_type=rotation|p2_name=y |p3_type=float|p3_name=t |return_type=rotation |return_value=returns the interpolatio…") |
m (<lsl> tag to <source>) |
||
Line 9: | Line 9: | ||
|func_desc= | |func_desc= | ||
Spherical-Cosine interpolation between two rotations. | Spherical-Cosine interpolation between two rotations. | ||
|spec=< | |spec=<source lang="lsl2">rotation rCos(rotation x, rotation y, float t){ | ||
float f = (1-llCos(t*PI))/2; | float f = (1-llCos(t*PI))/2; | ||
float ang = llAngleBetween(x, y); | float ang = llAngleBetween(x, y); | ||
Line 15: | Line 15: | ||
return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*f); | return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*f); | ||
} | } | ||
// Released into public domain. By Nexii Malthus.</ | // Released into public domain. By Nexii Malthus.</source> | ||
|examples=< | |examples=<source lang="lsl2"></source> | ||
|cat1=Examples | |cat1=Examples | ||
}} | }} |
Latest revision as of 16:01, 24 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: rotation rCos( rotation x, rotation y, float t );
Spherical-Cosine interpolation between two rotations.
Returns a rotation
• rotation | x | |||
• rotation | y | |||
• float | t |
Specification
rotation rCos(rotation x, rotation y, float t){
float f = (1-llCos(t*PI))/2;
float ang = llAngleBetween(x, y);
if(ang > PI) ang -= TWO_PI;
return x * llAxisAngle2Rot(llRot2Axis(y/x)*x, ang*f);
}
// Released into public domain. By Nexii Malthus.
Examples