简体   繁体   中英

Numpy and dot product on 3D matrices

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 !

使用rot旋转3x3旋转数组并协调3xnPoints坐标集(即每一列是一个点),您可以执行以下操作:

np.dot(rot, coords)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM