0

I running a project and cant import numpy-quaternion on it. So i have to customize some function. One of them is np.slerp_vectorized. But when i search the formula and try to implement, it has a different result and i dont know if i was wrong or np.slerp_vectorized has a different formula. Here is the code:


import numpy as np
import quaternion
from pyquaternion import Quaternion
from scipy.spatial.transform import Slerp

origin = np.slerp_vectorized(quaternion.from_float_array([1,2,3,4]),quaternion.from_float_array([3,3,3,3]), 0.5)

def slerp_(q1, q2, t):
    Q = ((q2*q1.inverse)**t)*q1
    return np.array([Q[0],Q[1],Q[2],Q[3]])
# using pyquaternion
custom = slerp(Quaternion([1,2,3,4]), Quaternion([3,3,3,3]), 0.5)```

Im trying to get the same result with np.slerp_vectorized but i dont have its formula
  • and the result: origin quaternion(-4.35914827777268, -1.85189174023389, 0.655364797304903, 3.16262133484369) and custom Quaternion(2.0005433530939762, 2.5356464693538205, 3.0707495856136653, 3.6058527018735096). I dont know why it has there differnce – Nhật Minh Lê Feb 02 '23 at 02:06

0 Answers0