Skip to content

Commit

Permalink
Fix bug of data preprocess. Ref #7
Browse files Browse the repository at this point in the history
  • Loading branch information
thss15fyt committed Sep 28, 2019
1 parent a102e65 commit 4d3cd63
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions data/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def find_neighbor(faces, faces_contain_this_vertex, vf1, vf2, except_face):
for i in faces_contain_this_vertex[vf1] & faces_contain_this_vertex[vf2]:
for i in (faces_contain_this_vertex[vf1] & faces_contain_this_vertex[vf2]):
if i != except_face:
face = faces[i].tolist()
face.remove(vf1)
Expand All @@ -29,7 +29,7 @@ def find_neighbor(faces, faces_contain_this_vertex, vf1, vf2, except_face):
if not os.path.exists(phrase_path):
os.mkdir(phrase)

files = glob(os.path.join(phrase_path, '*.off'))
files = glob.glob(os.path.join(phrase_path, '*.off'))
for file in files:
# load mesh
mesh = pymesh.load_mesh(file)
Expand Down Expand Up @@ -57,20 +57,20 @@ def find_neighbor(faces, faces_contain_this_vertex, vf1, vf2, except_face):

# get neighbors
faces_contain_this_vertex = []
for i in len(vertices):
for i in range(len(vertices)):
faces_contain_this_vertex.append(set([]))
centers = []
corners = []
for f in faces:
[v1, v2, v3] = f
for i in range(len(faces)):
[v1, v2, v3] = faces[i]
x1, y1, z1 = vertices[v1]
x2, y2, z2 = vertices[v2]
x3, y3, z3 = vertices[v3]
centers.append([(x1 + x2 + x3) / 3, (y1 + y2 + y3) / 3, (z1 + z2 + z3) / 3])
corners.append([x1, y1, z1, x2, y2, z2, x3, y3, z3])
faces_contain_this_vertex[v1].add(f)
faces_contain_this_vertex[v2].add(f)
faces_contain_this_vertex[v3].add(f)
faces_contain_this_vertex[v1].add(i)
faces_contain_this_vertex[v2].add(i)
faces_contain_this_vertex[v3].add(i)

neighbors = []
for i in range(len(faces)):
Expand Down

0 comments on commit 4d3cd63

Please sign in to comment.