问题描述
我正在尝试将世界变换应用于numpy矩阵。但是,我似乎找不到一种简单的方法来执行Nx4向量的4x4矩阵乘法,其中N是顶点数。
我都尝试过 Nx4x4 @ Nx4 和 4x4 @ Nx4 乘法。当然,我可以明智地做到这一点,但我希望有一种更聪明的方法来做到这一点。
vertices = np.ones([VERTEX_COUNT,4])
vertices[:,0:3] = vertex_map[element.path_vertices]
matrix = np.full([VERTEX_COUNT,4,4],np.reshape(element.matrix,[4,4]))
transformed = matrix @ vertices # dimension mismatch
# i would rather not do this
# matrix = np.reshape(element.matrix,4])
# transformed = np.array([matrix @ vertex for vertex in vertices])
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)