我不知道为什么,但是我一直得到这个错误,即使列表索引没有超过索引的数目。获取此错误的代码如下:
normalisedFaces = np.array([])
for f in range(len(vertextNormalIndices)):
nF1 = vecNormals[vertextNormalIndices[f][0][0]]
nF2 = vecNormals[vertextNormalIndices[f][1][0]]
nF3 = vecNormals[vertextNormalIndices[f][2][0]]
normalisedFaces = np.hstack((normalisedFaces,(np.add(nF1,np.add(nF2,nF3))/ 3)))
print(f)
time.sleep(3)
print(normalisedFaces[f])
我唯一的猜测是我正在达到数组的最大大小(?)在这个例子中,循环的范围是529,但是当我到达519时,就会出现错误。如果我把循环改成:
^{pr2}$然后它到达了范围的末尾(在本例中是329)。在
怎么解决这个问题呢?如果可能的话,我不希望嵌套这个循环,并且必须拆分每个数组的大小,例如%max==300
如有任何指导,我们将不胜感激
顶点法线索引的最后8个索引:(因此,获取每行的第一个编号,例如278195281)
根据您的评论和回溯,错误在这一行:
nF1 = vecNormals[vertextNormalIndices[f][0][0]]
因此,错误必须是}是空列表-请尝试在循环中打印出它们。在
vertextNormalIndices[519]
或{作为旁白:
{a1'要直接遍历元素的索引,还需要使用
相关问题 更多 >
编程相关推荐