summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-10-07 17:21:53 -0400
committerStan Seibert <stan@mtrr.org>2011-10-07 17:21:53 -0400
commit70135ca54027f90dd30fa53827646793acc561d0 (patch)
tree85e84249c4673e4d2cd2bec9536732d63fd37300
parentb97a56f5f81a806d05d9c55146acad73af2a57bc (diff)
downloadchroma-70135ca54027f90dd30fa53827646793acc561d0.tar.gz
chroma-70135ca54027f90dd30fa53827646793acc561d0.tar.bz2
chroma-70135ca54027f90dd30fa53827646793acc561d0.zip
Speed up remove_duplicate_vertices by a factor of 3.
Vectorizing a lambda function is really slow, and it turns out that advanced indexing already does what we want to remap the triangle vertices to their unique values.
-rw-r--r--chroma/geometry.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/chroma/geometry.py b/chroma/geometry.py
index 80b83fc..1fa5733 100644
--- a/chroma/geometry.py
+++ b/chroma/geometry.py
@@ -51,7 +51,7 @@ class Mesh(object):
# turn the structured vertex array back into a normal array
self.vertices = unique_vertices.view(self.vertices.dtype).reshape((unique_vertices.shape[0], self.vertices.shape[1]))
# remap the triangles to the unique vertices
- self.triangles = np.vectorize(lambda i: inverse[i])(self.triangles)
+ self.triangles = inverse[self.triangles]
def assemble(self, key=slice(None), group=True):
"""