scipy.spatial.transform.Rotation.
旋轉量值#
- Rotation.magnitude(self)#
取得旋轉的量值。
- 返回值:
- magnitudendarray 或 float
弧度表示的角度,如果物件包含單次旋轉則為 float,如果物件包含多次旋轉則為 ndarray。量值將始終在 [0, pi] 範圍內。
範例
>>> from scipy.spatial.transform import Rotation as R >>> import numpy as np >>> r = R.from_quat(np.eye(4)) >>> r.as_quat() array([[ 1., 0., 0., 0.], [ 0., 1., 0., 0.], [ 0., 0., 1., 0.], [ 0., 0., 0., 1.]]) >>> r.magnitude() array([3.14159265, 3.14159265, 3.14159265, 0. ])
單次旋轉的量值
>>> r[0].magnitude() 3.141592653589793