This page was generated from
doc/rotation/kochanek-bartels.ipynb.
Interactive online version:
.
Kochanek–Bartels-like Rotation Splines§
[1]:
import numpy as np
[2]:
from helper import angles2quat, animate_rotations, display_animation
splines.quaternion.KochanekBartels
[3]:
from splines.quaternion import KochanekBartels
[4]:
rotations = [
angles2quat(0, 0, 0),
angles2quat(90, 0, 0),
angles2quat(90, 90, 0),
angles2quat(90, 90, 90),
]
Uniform Catmull–Rom§
[5]:
s = KochanekBartels(rotations)
[6]:
times = np.linspace(s.grid[0], s.grid[-1], 100)
[7]:
ani = animate_rotations(s.evaluate(times), figsize=(4, 3))
[8]:
display_animation(ani, default_mode='reflect')
Non-Uniform Catmull–Rom§
[9]:
grid = 0, 0.2, 0.9, 1.2
[10]:
s = KochanekBartels(rotations, grid)
[11]:
times = np.linspace(s.grid[0], s.grid[-1], 100)
[12]:
ani = animate_rotations(s.evaluate(times), figsize=(4, 3))
[13]:
display_animation(ani, default_mode='reflect')
TCB§
[14]:
s = KochanekBartels(rotations, tcb=[0, 1, 1])
[15]:
times = np.linspace(s.grid[0], s.grid[-1], 100)
[16]:
ani = animate_rotations(s.evaluate(times), figsize=(4, 3))
[17]:
display_animation(ani, default_mode='reflect')
Edge Cases§
0 or 1 quaternions: not allowed
2 quaternions: Slerp
180° rotations (dot product = 0)?
…
2 quaternions:
[18]:
rotations = [
angles2quat(0, 0, 0),
angles2quat(90, 90, 90),
]
[19]:
s = KochanekBartels(rotations)
[20]:
times = np.linspace(s.grid[0], s.grid[-1], 100)
[21]:
ani = animate_rotations(s.evaluate(times), figsize=(4, 3))
[22]:
display_animation(ani, default_mode='reflect')