粗大メモ置き場

個人用,たまーに来訪者を意識する雑記メモ

Does Linear or Spherical quaternion interpolation make large difference? / Python

As a result, it seems NOT so much.
Using my own library for right handed quaternion caluclation.
ossyaritoori.hatenablog.com

Online iPython console

I tried online iPython console. It is pretty good.
Try IPython from your Browser: PythonAnywhere

Comparison

Try interpolating quaternions below:

q = [0.7071067811865475, 0, 0, 0.7071067811865475]
qq = [-0.006504044267823542,
 0.47180695486352564,
 -0.024006722434494504,
 0.8813509925271104] 

Figure below represents the idea of two interpolation method.
f:id:ossyaritoori:20170824091128p:plain

Linear Interpolation (LERP)

Linear Interpolation is quite simple.
Just do interpolation and then normalize.

Half point:

In [32]: q_LERP(q,qq,0.5)
Out[32]: (0.5820332949500574, 0.12762550407838416, 0.0, 0.8030871523554078)

Quater point:

In [33]: q_LERP(q,qq,0.25)
Out[33]: (0.6485637875878557, 0.06347682311265765, 0.0, 0.7585088703220412)

Spherical Interpolation (SLERP)

Spherical Interpolation is little bit complicated but graphically it is easy to understand.
Slerp - Wikipedia

Half point:

In [34]: q_SLERP(q,qq,0.5)
Out[34]: (0.5820332949500575, 0.12762550407838413, 0.0, 0.8030871523554077)

Quater point:

In [35]: q_SLERP(q,qq,0.25)
Out[35]: (0.6479108467340242, 0.06414349374669522, 0.0, 0.759010636878277)

Difference

So, it seems that if interpolating point is far from center, the result become worse.

Half point:

q_LERP(q,qq,0.5) =  [0.5820332949500574, 0.12762550407838416, 0.0, 0.8030871523554078]
q_SLERP(q,qq,0.5) =  [0.5820332949500575, 0.12762550407838413, 0.0, 0.8030871523554077]

Quater point:

q_LERP(q,qq,0.25) =  [0.6485637875878557, 0.06347682311265765, 0.0, 0.7585088703220412]
q_SLERP(q,qq,0.25) =  [0.6479108467340242, 0.06414349374669522, 0.0, 0.759010636878277]

1/10 point:

q_LERP(q,qq,0.1) = [0.6847348182509574, 0.02518528264165945, 0.0, 0.728357007389294]
q_SLERP(q,qq,0.1)= [0.6842708912820434, 0.025694514075164966, 0.0, 0.7287750951360228]

The below graph will be helpful to understand these difference.

f:id:ossyaritoori:20170824091145p:plain