{ } Raw JSON

bundles / scipy 1.17.1 / scipy / spatial / transform / _rotation / Slerp

class

scipy.spatial.transform._rotation:Slerp

source: /scipy/spatial/transform/_rotation.py :2681

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)
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)

See also

Rotation

Aliases

  • scipy.spatial.transform.Slerp

Referenced by

This package