n = self.vertices.index(v)
return [(n+i)%len(self.vertices) for i in range(len(self.vertices))]
- def pivot_vertices(self, *vt):
- flags = [(v in vt) for v in self.vertices]
- l = len(self.vertices)
- for i in range(l):
- if flags[i] and not flags[(i+l-1)%l]:
- return self.vertices[i:]+self.vertices[:i]
-
def get_edge(self, v1, v2):
key = make_edge_key(v1.index, v2.index)
for e in self.edges:
for i, v in enumerate(self.vertices):
v.normal = mathutils.Vector()
for f in v.faces:
- fv = f.pivot_vertices(v)
- edge1 = fv[1].co-fv[0].co
- edge2 = fv[-1].co-fv[0].co
+ vi = f.pivot_vertex(v)
+ edge1 = f.vertices[vi[1]].co-v.co
+ edge2 = f.vertices[vi[-1]].co-v.co
if edge1.length and edge2.length:
# Use the angle between edges as a weighting factor. This gives
# more consistent normals on bends with an inequal number of