Closed tomvanmele closed 6 years ago
this is now solved. problem was result of transition from face cycles as dicts versus lists. the cases when half-edges were formed by vertices at the start and end of the vertex lists were not properly handled.
def unify(node, nbr):
# find the common edge
for u, v in pairwise(faces[nbr] + faces[nbr][0:1]):
if u in faces[node] and v in faces[node]:
# node and nbr have edge u-v in common
i = faces[node].index(u)
j = faces[node].index(v)
if i == j - 1:
# if the traversal of a neighbouring halfedge
# is in the same direction
# flip the neighbour
faces[nbr][:] = faces[nbr][::-1]
return
is now
def unify(node, nbr):
# find the common edge
for u, v in pairwise(faces[nbr] + faces[nbr][0:1]):
if u in faces[node] and v in faces[node]:
# node and nbr have edge u-v in common
i = faces[node].index(u)
j = faces[node].index(v)
if i == j - 1 or (j == 0 and u == faces[node][-1]):
# if the traversal of a neighbouring halfedge
# is in the same direction
# flip the neighbour
faces[nbr][:] = faces[nbr][::-1]
return
the snippet included in the original post works fine now...
Displays a hull with variable colors for the faces, which means that some faces are seen from the back and others from the front.