Difference between revisions of "Slerp"
Jump to navigation
Jump to search
m |
Frionil Fang (talk | contribs) |
||
Line 1: | Line 1: | ||
'''Slerp''' is shorthand for '''spherical linear interpolation''', introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating 3D rotation. It refers to constant speed motion along a unit radius great circle arc, given the ends and an interpolation parameter between 0 and 1. | '''Slerp''' is shorthand for '''spherical linear interpolation''', introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating 3D rotation. It refers to constant speed motion along a unit radius great circle arc, given the ends and an interpolation parameter between 0 and 1. | ||
The following slerp algorithm uses '''a''' and '''b''' for ends and '''t''' for the interpolation parameter.<br> | More detail: {{Wikipedia|Slerp}}. | ||
The following slerp algorithm uses '''a''' and '''b''' for ends and '''t''' for the interpolation parameter.<br/> | |||
To continue the rotation past the ends use a value for '''t''' outside the range '''{{interval|gte=0|lte=1|center=t}}'''. | To continue the rotation past the ends use a value for '''t''' outside the range '''{{interval|gte=0|lte=1|center=t}}'''. | ||
< | <syntaxhighlight lang="lsl2">rotation slerp( rotation a, rotation b, float t ) { | ||
return llAxisAngle2Rot( llRot2Axis(b /= a), t * llRot2Angle(b)) * a; | return llAxisAngle2Rot( llRot2Axis(b /= a), t * llRot2Angle(b)) * a; | ||
}//Written collectively, Taken from http://forums-archive.secondlife.com/54/3b/50692/1.html</ | }//Written collectively, Taken from http://forums-archive.secondlife.com/54/3b/50692/1.html</syntaxhighlight> | ||
Source: http://forums-archive.secondlife.com/54/3b/50692/1.html | Source: http://forums-archive.secondlife.com/54/3b/50692/1.html |
Revision as of 06:31, 29 October 2023
Slerp is shorthand for spherical linear interpolation, introduced by Ken Shoemake in the context of quaternion interpolation for the purpose of animating 3D rotation. It refers to constant speed motion along a unit radius great circle arc, given the ends and an interpolation parameter between 0 and 1.
More detail: Slerp.
The following slerp algorithm uses a and b for ends and t for the interpolation parameter.
To continue the rotation past the ends use a value for t outside the range [0, 1].
rotation slerp( rotation a, rotation b, float t ) {
return llAxisAngle2Rot( llRot2Axis(b /= a), t * llRot2Angle(b)) * a;
}//Written collectively, Taken from http://forums-archive.secondlife.com/54/3b/50692/1.html
Source: http://forums-archive.secondlife.com/54/3b/50692/1.html