From 3076e6b2032d0acbd44966a9428fdc6de1bbcf3b Mon Sep 17 00:00:00 2001 From: Stan Seibert Date: Fri, 13 Jan 2012 11:47:35 -0500 Subject: Add md5() hash method to chroma.geometry.Mesh --- chroma/geometry.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/chroma/geometry.py b/chroma/geometry.py index 08f57d1..1d2175c 100644 --- a/chroma/geometry.py +++ b/chroma/geometry.py @@ -77,6 +77,13 @@ class Mesh(object): def __add__(self, other): return Mesh(np.concatenate((self.vertices, other.vertices)), np.concatenate((self.triangles, other.triangles + len(self.vertices)))) + def md5(self): + '''Return the MD5 hash of the vertices and triangles in this mesh as a + hexidecimal string.''' + checksum = md5(self.vertices) + checksum.update(self.triangles) + return checksum.hexdigest() + def memoize_method_with_dictionary_arg(func): def lookup(*args): # based on function by Michele Simionato -- cgit