fixed bug where faces_for_vert came back changed for subsequent calls to get_containing_simplex (was adding/removing from list alias, now I copy the list).

This commit is contained in:
Stephen McQuay 2010-11-01 20:24:12 -06:00
parent 99b7dd6997
commit e8d709ee66

View File

@ -50,7 +50,7 @@ class grid(object):
simplex = None simplex = None
checked_faces = [] checked_faces = []
faces_to_check = self.faces_for_vert[closest_point] faces_to_check = list(self.faces_for_vert[closest_point])
attempts = 0 attempts = 0
while not simplex and faces_to_check: while not simplex and faces_to_check:
@ -66,14 +66,14 @@ class grid(object):
simplex = cur_face simplex = cur_face
continue continue
new_facest = []
for neighbor in cur_face.neighbors: for neighbor in cur_face.neighbors:
if (neighbor not in checked_faces) and (neighbor not in faces_to_check): if (neighbor not in checked_faces) and (neighbor not in faces_to_check):
faces_to_check.append(neighbor) faces_to_check.append(neighbor)
if not simplex: if not simplex:
raise AssertionError('no containing simplex found') raise Exception('no containing simplex found')
log.debug("simplex vert indicies: %s" % simplex.verts)
R = self.create_mesh(simplex.verts) R = self.create_mesh(simplex.verts)
log.debug('total attempts before finding simplex: %d' % attempts) log.debug('total attempts before finding simplex: %d' % attempts)
@ -106,7 +106,7 @@ class grid(object):
# and some UNIQUE extra verts # and some UNIQUE extra verts
(dist, indicies) = self.tree.query(X, simplex_size + extra_points) (dist, indicies) = self.tree.query(X, simplex_size + extra_points)
log.info("extra indicies: %s" % indicies) log.debug("extra indicies: %s" % indicies)
unique_indicies = [] unique_indicies = []
for index in indicies: for index in indicies:
@ -196,13 +196,12 @@ class delaunay_grid(grid):
simplex = cur_face simplex = cur_face
continue continue
new_facest = []
for neighbor in cur_face.neighbors: for neighbor in cur_face.neighbors:
if (neighbor not in checked_faces) and (neighbor not in faces_to_check): if (neighbor not in checked_faces) and (neighbor not in faces_to_check):
faces_to_check.append(neighbor) faces_to_check.append(neighbor)
if not simplex: if not simplex:
raise AssertionError('no containing simplex found') raise Exception('no containing simplex found')
R = self.create_mesh(simplex.verts) R = self.create_mesh(simplex.verts)