在添加邻居语句(我用“新”评论)之前,一切正常。现在,使用numpy.asarray时,出现以下错误:
ValueError:无法将输入数组从形状 (3,3) 广播到形状 (3)。
我真的很困惑,因为新行并没有改变旋转阵列的任何内容。
def rre(mesh, rotations):
"""
Relative Rotation Encoding (RRE).
Return a compact representation of all relative face rotations.
"""
all_rel_rotations = neighbors = []
for f in mesh.faces():
temp = [] # new
for n in mesh.ff(f):
rel_rotation = np.matmul(rotations[f.idx()], np.linalg.inv(rotations[n.idx()]))
all_rel_rotations.append(rel_rotation)
temp.append(n.idx()) # new
neighbors.append(temp) # new
all_rel_rotations = np.asarray(all_rel_rotations)
neighbors = np.asarray(neighbors) # new
return all_rel_rotations, neighbors