Name[]
lerp - returns linear interpolation of two scalars or vectors based on a weight.
Synopsis[]
vector1 lerp(vector1 a, vector1 b, vector w); vector2 lerp(vector2 a, vector2 b, vector w); vector3 lerp(vector3 a, vector3 b, vector w); vector4 lerp(vector4 a, vector4 b, vector w);
Parameters[]
- a
- Vector or scalar to weight; returned when w is zero.
- b
- Vector or scalar to weight; returned when w is one.
- w
- Vector or scalar weight.
Description[]
Returns the linear interpolation of a and b based on weight w.
a and b are either both scalars or both vectors of the same length. The weight w may be a scalar or a vector of the same length as a and b. w can be any value (so is not restricted to be between zero and one); if w has values outside the [0,1] range, it actually extrapolates.lerp returns a when w is zero and returns b when w is one.