crertel / graphmath

An Elixir library for performing 2D and 3D mathematics.
The Unlicense
81 stars 13 forks source link

Quatern Slerp #5

Closed Host32 closed 9 years ago

Host32 commented 9 years ago

slerp(lhs, rhs, t) Performs Spherical linear interpolation between two quaternions, and returns the result.

lhs is the first quatern

rhs is the second quatern

t is the interpolation parameter that will interpolate to lhs when t = 0 and to rhs when t = 1.

It returns a quatern representing the normalized interpolation point.

Note: slerp has the proprieties of performing the interpolation at constant velocity However, it's NOT commutative, which means slerp( A, B, 0.75 ) != slerp( B, A, 0.25 ) therefore be careful if your code relies in the order of the operands. This is specially important in IK animation.