沿z轴python的旋转矩阵

时间:2017-02-18 14:58:51

标签: python numpy

我想沿z轴旋转矢量:

#!/usr/bin/env python
import numpy as np

theta = np.radians(90)
c, s = np.cos(theta), np.sin(theta)
R = np.matrix([[c, -s, 0], [s, c,0], [0,0,1]])
v = np.matrix( [ 0.        ,  1.83124623, -0.52249415] )

print R*v.reshape(3,1)

我得到了回报:

[[ -1.83124623e+00]
 [  1.12131492e-16]
 [ -5.22494150e-01]]

0 个答案:

没有答案