Skip to content

Commit

Permalink
Fix bug that prevented double vertices from being removed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Schlechtwetterfront committed Sep 4, 2016
1 parent baa046c commit a278c8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Application/Modules/msh2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1139,18 +1139,24 @@ def clear_doubles(self):
new_vertices_set = set()
len_new_verts = 0

num_cleared_vertices = 0

for index, vert in enumerate(self.vertices):
if vert in new_vertices_set:
index_original = new_vertices.index(vert)
# Insert into indices map.
self.index_map[index] = index_original

num_cleared_vertices += 1
else:
new_vertices.append(vert)
new_vertices_set.add(vert)
self.index_map[index] = len_new_verts
len_new_verts += 1
self.vertices.vertices = new_vertices

logging.info('Cleared %s doubles.', num_cleared_vertices)

def dump(self, fh):
'''Dump information to open filehandler fileh.'''
fh.write('\t\t\t--- SegmentGeometry ---\n')
Expand Down Expand Up @@ -1851,6 +1857,9 @@ def dump(self, fh):
fh.write('\t\t\tPos: {0:3}, {1:3}, {2:3}\n'.format(*self.pos))
fh.write('\t\t\tUV: {0:3}, {1:3}\n'.format(*self.uv))

def __hash__(self):
return hash((self.x, self.y, self.z, self.u, self.v, self.nx, self.ny, self.nz))

def __eq__(self, other):
if (self.x == other.x) and (self.y == other.y) and (self.z == other.z):
if (self.u == other.u) and (self.v == other.v):
Expand Down
2 changes: 1 addition & 1 deletion xsizet.ver
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.0030
1.3.0031

0 comments on commit a278c8a

Please sign in to comment.