Normals were reversed and edge links were not being updated properly.
normals = []
for j in range(nverts):
- normals.append(edge_vecs[j].cross(edge_vecs[j-1]).normalized())
+ normals.append(edge_vecs[j-1].cross(edge_vecs[j]).normalized())
# Check which diagonal results in a flatter triangulation
flatness1 = normals[0].dot(normals[2])
else:
nf.edges = [f.edges[1], f.edges[2], ne]
f.edges = [f.edges[0], ne, f.edges[3]]
+ for e in nf.edges:
+ if e!=ne:
+ e.faces.remove(f)
+ e.faces.append(nf)
f.normal = normals[1-cut_index]
nf.normal = normals[3-cut_index]