return e
raise KeyError("No edge %s"%(key,))
+ def get_neighbors(self):
+ neighbors = [e.other_face(f) for e in self.edges]
+ return list(filter(bool, neighbors))
+
class Line:
def __init__(self, e):
v.bino.normalize()
def create_strip(self, face, max_len):
+ # Find an edge with another unused face next to it
edge = None
for e in face.edges:
other = e.other_face(face)
if not edge:
return None
+ # Add initial vertices so that we'll complete the edge on the first
+ # iteration
vertices = face.pivot_vertices(*edge.vertices)
if len(vertices)==3:
result = [vertices[-1], vertices[0]]
result = [vertices[-2], vertices[-1]]
while 1:
+ face.flag = True
+
vertices = face.pivot_vertices(*result[-2:])
k = len(result)%2
- face.flag = True
+ # Quads need special handling because the winding of every other
+ # triangle in the strip is reversed
if len(vertices)==4 and not k:
result.append(vertices[3])
result.append(vertices[2])
if len(result)>=max_len:
break
+ # Hop over the last edge
edge = face.get_edge(*result[-2:])
-
- next = edge.other_face(face)
- if not next or next.flag:
+ face = edge.other_face(face)
+ if not face or face.flag:
break
- face = next
return result