简体   繁体   English

在3D矩阵上的块状和点积

[英]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. 我的旋转矩阵具有(3,3)形状。 My coordinates matrix has a (nPoints, 3) shape for the (X, Y, Z) dimensions. 我的坐标矩阵的(X,Y,Z)尺寸为(nPoints,3)形状。

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). 我想做的就是使用Numpy的功能(在我的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. 在操作结束时,我想要一个具有(nPoints,3)旋转的矩阵。

Thanks in advance for your time and your answers ! 在此先感谢您的时间和回答!

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

np.dot(rot, coords)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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