Commit 7d8ed414 authored by Dario Seyb's avatar Dario Seyb

made PointAttribute much faster

parent e05e5646
This diff is collapsed.
......@@ -64,15 +64,18 @@ class PointAttribute(IndexedAttribute):
def resolve(self, face_indices):
result = []
vertex_to_face = dict()
for fidx, face in enumerate(face_indices):
for index_in_face, vidx in enumerate(face):
if vidx not in vertex_to_face:
vertex_to_face[vidx] = []
vertex_to_face[vidx].append((fidx, index_in_face))
for i, val in enumerate(self.values):
idx = self.indices[i]
# find all faces that contain the vertex
for f_idx, face in enumerate(face_indices):
# check if vertex is in face
idx_in_face = find(idx, face)
# if yes, add value for vertex in that face
if idx_in_face is not None:
result.append((f_idx, idx_in_face, val))
if idx in vertex_to_face:
for occurence in vertex_to_face[idx]:
result.append((occurence[0], occurence[1], val))
return result
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment