24 Nov
2008
24 Nov
'08
2:52 a.m.
2008/11/21 Sébastien Barthélemy
In this spirit, in numpy a set of rotation matrices could be built in the following way:
def rotx(theta): """ SE(3) matrices corresponding to a rotation around x-axis. Theta is a 1-d array """ costheta = np.cos(theta) sintheta = np.sin(theta) H = np.zeros((theta.size,4,4)) H[:,0,0] = 1 H[:,3,3] = 1 H[:,1,1] = costheta H[:,2,2] = costheta H[:,2,1] = sintheta H[:,1,2] = sintheta return H
Btw, you can just create an array of these elements directly: np.array([[costheta, -sintheta, 0], [sintheta, costheta , 0], [0 , 0 , 1]]) Regards Stéfan