v = physics.Vect:slerp(vec, f)
Parameter |
Type |
Description |
---|---|---|
self |
in physics.Vect |
A unit vector |
vec |
in physics.Vect |
The other unit vector |
f |
in number |
f is a fractional number from 0 to 1 representing the proportion of distance between self and vec |
v |
out physics.Vect |
A vector interpolated between self and vec |
Computes a spherical linear interpolation between unit vectors self and vec. See http://en.wikipedia.org/wiki/Slerp for a discussion of the meaning, value, and usage of spherical linear interpolation.
Listing 19.1: Spherical Linear Interpolation Example
local vect1 = physics.Vect(math.pi/3) -- unit vector
local vect2 = physics.Vect(math.pi/2) -- unit vector
local result = vect1:slerp(vect2, 0.55)
Note
This routine computes meaningful results only when the two inputs are unit vectors. May not behave as expected for f larger than 1.0 or less than 0.
Introduced in platform.apiLevel = '2.0'