scipy 1.8.0 Pypi GitHub Homepage
Other Docs
MethodsNotesParametersBackRef

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

Methods

Notes

versionadded

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.

Spherical Linear Interpolation of Rotations.

See Also

Rotation

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.31443779, -27.50095894,  -3.7275787 ],
       [ -1.79924227, -24.69421529, 164.57701743],
       [146.15020772,  43.22849451, -31.34891088],
       [ 46.39959442,  11.62126073, -45.99719267],
       [-88.94647804, -49.64400082, -65.80546984]])

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.31443779,  -27.50095894,   -3.7275787 ],
       [   4.74588574,  -32.44683966,   81.25139984],
       [  10.71094749,  -31.56690154,   38.06896408],
       [  -1.79924227,  -24.69421529,  164.57701743],
       [  11.72796022,   51.64207311, -171.7374683 ],
       [ 146.15020772,   43.22849451,  -31.34891088],
       [  68.10921869,   20.67625074,  -48.74886034],
       [  46.39959442,   11.62126073,  -45.99719267],
       [  12.35552615,    4.21525086,  -64.89288124],
       [ -30.08117143,  -19.90769513,  -78.98121326],
       [ -88.94647804,  -49.64400082,  -65.80546984]])
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

scipy.spatial.transform._rotation.Slerp scipy.spatial.transform._rotation.Rotation

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /scipy/spatial/transform/_rotation.cpython-39-darwin.so#None
type: <class 'type'>
Commit: