本文簡要介紹 python 語言中 scipy.spatial.transform.Rotation.as_matrix
的用法。
用法:
Rotation.as_matrix(self)#
表示為旋轉矩陣。
3D 旋轉可以使用旋轉矩陣來表示,旋轉矩陣是 3 x 3 實數正交矩陣,行列式等於 +1 [1]。
- matrix: ndarray,形狀 (3, 3) 或 (N, 3, 3)
形狀取決於用於初始化的輸入的形狀。
返回 ::
注意:
此函數之前稱為as_dcm。
參考:
例子:
>>> from scipy.spatial.transform import Rotation as R >>> import numpy as np
表示單次旋轉:
>>> r = R.from_rotvec([0, 0, np.pi/2]) >>> r.as_matrix() array([[ 2.22044605e-16, -1.00000000e+00, 0.00000000e+00], [ 1.00000000e+00, 2.22044605e-16, 0.00000000e+00], [ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]) >>> r.as_matrix().shape (3, 3)
表示具有單次旋轉的堆棧:
>>> r = R.from_quat([[1, 1, 0, 0]]) >>> r.as_matrix() array([[[ 0., 1., 0.], [ 1., 0., 0.], [ 0., 0., -1.]]]) >>> r.as_matrix().shape (1, 3, 3)
表示多次旋轉:
>>> r = R.from_rotvec([[np.pi/2, 0, 0], [0, 0, np.pi/2]]) >>> r.as_matrix() array([[[ 1.00000000e+00, 0.00000000e+00, 0.00000000e+00], [ 0.00000000e+00, 2.22044605e-16, -1.00000000e+00], [ 0.00000000e+00, 1.00000000e+00, 2.22044605e-16]], [[ 2.22044605e-16, -1.00000000e+00, 0.00000000e+00], [ 1.00000000e+00, 2.22044605e-16, 0.00000000e+00], [ 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]]]) >>> r.as_matrix().shape (2, 3, 3)
相關用法
- Python SciPy Rotation.as_mrp用法及代碼示例
- Python SciPy Rotation.as_euler用法及代碼示例
- Python SciPy Rotation.as_quat用法及代碼示例
- Python SciPy Rotation.as_rotvec用法及代碼示例
- Python SciPy Rotation.approx_equal用法及代碼示例
- Python SciPy Rotation.apply用法及代碼示例
- Python SciPy Rotation.align_vectors用法及代碼示例
- Python SciPy Rotation.from_matrix用法及代碼示例
- Python SciPy Rotation.__pow__用法及代碼示例
- Python SciPy Rotation.magnitude用法及代碼示例
- Python SciPy Rotation.from_quat用法及代碼示例
- Python SciPy Rotation.from_mrp用法及代碼示例
- Python SciPy Rotation.__getitem__用法及代碼示例
- Python SciPy Rotation.from_rotvec用法及代碼示例
- Python SciPy Rotation.__mul__用法及代碼示例
- Python SciPy Rotation.inv用法及代碼示例
- Python SciPy Rotation.random用法及代碼示例
- Python SciPy Rotation.from_euler用法及代碼示例
- Python SciPy Rotation.mean用法及代碼示例
- Python SciPy RealData.set_meta用法及代碼示例
- Python SciPy RectBivariateSpline.__call__用法及代碼示例
- Python SciPy RectSphereBivariateSpline.ev用法及代碼示例
- Python SciPy RegularGridInterpolator.__call__用法及代碼示例
- Python SciPy RectSphereBivariateSpline.__call__用法及代碼示例
- Python SciPy RectBivariateSpline.ev用法及代碼示例
注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.spatial.transform.Rotation.as_matrix。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。