0
votes

I'm trying to apply a rotation matrix on a arrays of coordinates and I have a problem with the shapes of my arrays.

My rotation matrix has a (3,3) shape. My coordinates matrix has a (nPoints, 3) shape for the (X, Y, Z) dimensions.

What I would like to do is to apply my rotation matrix to all my points using the power of Numpy (without a loop on my nPoints). I've try to add dimension to my matrices but I didn't get what I want. At the end of the operation I want a matrix which has a (nPoints,3) where the rotation has been applied.

Thanks in advance for your time and your answers !

1

1 Answers

1
votes

With rot your 3x3 rotation array and coords your 3xnPoints set of coordinates (i.e., each column is one point), you do:

np.dot(rot, coords)