Home Examples Installation Documentation Contact Help

slerp

Specification

Location Author Maintained by
isl/math/quaternion.py Kenny Erleben DIKU

Purpose & Params

The purpose of lerp is to find a spherical linear interpolation of two quaterions.

Example

    radian    = (0.5 * np.pi)/2
    axis_1      = np.array([0,1,0])
    axis_2      = np.array([1,0,0])
    axis_unit_1 = axis_1 / np.linalg.norm(axis_1)
    axis_unit_2 = axis_2 / np.linalg.norm(axis_2)
    q_1  = quat.make(np.cos(radian),axis_unit_1[0] * np.sin(radian),axis_unit_1[1] * np.sin(radian),axis_unit_1[2] * np.sin(radian))
    q_2  = quat.make(np.cos(radian),axis_unit_2[0] * np.sin(radian),axis_unit_2[1] * np.sin(radian),axis_unit_2[2] * np.sin(radian))
    h    = 0.5
    print(quat.slerp(q_1,q_2,h))

output:

  [0.81649658 0.40824829 0.40824829 0.        ]