This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / spatial / transform / _rotation / Rotation / as_rotvec

function

scipy.spatial.transform._rotation:Rotation.as_rotvec

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

Signature

def as_rotvec(self, degrees: bool = False) → Array

Summary

Represent as rotation vectors.

Extended Summary

A rotation vector is a 3 dimensional vector which is co-directional to the axis of rotation and whose norm gives the angle of rotation [1].

Parameters

degrees : bool, optional

Returned magnitudes are in degrees if this flag is True, else they are in radians. Default is False.

Returns

rotvec : ndarray, shape (..., 3)

Shape depends on shape of inputs used for initialization.

Examples

from scipy.spatial.transform import Rotation as R
import numpy as np
✓
Represent a single rotation:
r = R.from_euler('z', 90, degrees=True)
✓
r.as_rotvec()
✗
array([0.    , 0.    , 1.5708])
r.as_rotvec().shape
✓
(3,)
Represent a rotation in degrees:
r = R.from_euler('YX', (-90, -90), degrees=True)
s = r.as_rotvec(degrees=True)
✓
s
np.linalg.norm(s)
✗
np.float64(119.99999999999997)
Represent a stack with a single rotation:
r = R.from_quat([[0, 0, 1, 1]])
✓
r.as_rotvec()
✗
array([[0.    , 0.    , 1.5708]])
r.as_rotvec().shape
✓
(1, 3)
Represent multiple rotations in a single object:
r = R.from_quat([[0, 0, 1, 1], [1, 1, 0, 1]])
✓
r.as_rotvec()
✗
array([[0.     , 0.     , 1.5708 ],
       [1.35102, 1.35102, 0.     ]])
r.as_rotvec().shape
✓
(2, 3)

Aliases

  • scipy.spatial.transform.Rotation.as_rotvec