This is a pre-release version (latest).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy latest / scipy / spatial / transform / _rotation / Slerp

class

scipy.spatial.transform._rotation:Slerp

source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/transform/_rotation.py:2672

Signature

class Slerp(times: ArrayLike, rotations: Rotation)

Members

Summary

Spherical Linear Interpolation of Rotations.

Extended Summary

The interpolation between consecutive rotations is performed as a rotation around a fixed axis with a constant angular velocity [1]. This ensures that the interpolated rotations follow the shortest path between initial and final orientations.

Parameters

times : array_like, shape (N,)

Times of the known rotations. At least 2 times must be specified.

rotations : `Rotation` instance

Rotations to perform the interpolation between. Must contain N rotations.

Methods

__call__

Notes

This class only supports interpolation of rotations with a single leading dimension.

Examples

from scipy.spatial.transform import Rotation as R
from scipy.spatial.transform import Slerp
✓
Setup the fixed keyframe rotations and times:
key_rots = R.random(5, random_state=2342345)
key_times = [0, 1, 2, 3, 4]
✓
Create the interpolator object:
slerp = Slerp(key_times, key_rots)
✓
Interpolate the rotations at the given times:
times = [0, 0.5, 0.25, 1, 1.5, 2, 2.75, 3, 3.25, 3.60, 4]
interp_rots = slerp(times)
✓
The keyframe rotations expressed as Euler angles:
key_rots.as_euler('xyz', degrees=True)
✗
array([[ 14.31444, -27.50096,  -3.72758],
       [ -1.79924, -24.69422, 164.57702],
       [146.15021,  43.22849, -31.34891],
       [ 46.39959,  11.62126, -45.99719],
       [-88.94648, -49.644  , -65.80547]])
The interpolated rotations expressed as Euler angles. These agree with the keyframe rotations at both endpoints of the range of keyframe times.
interp_rots.as_euler('xyz', degrees=True)
✗
array([[  14.31444,  -27.50096,   -3.72758],
       [   4.74589,  -32.44684,   81.2514 ],
       [  10.71095,  -31.5669 ,   38.06896],
       [  -1.79924,  -24.69422,  164.57702],
       [  11.72796,   51.64207, -171.73747],
       [ 146.15021,   43.22849,  -31.34891],
       [  68.10922,   20.67625,  -48.74886],
       [  46.39959,   11.62126,  -45.99719],
       [  12.35553,    4.21525,  -64.89288],
       [ -30.08117,  -19.9077 ,  -78.98121],
       [ -88.94648,  -49.644  ,  -65.80547]])

See also

Rotation

Aliases

  • scipy.spatial.transform.Slerp

Referenced by