diff options
author | Stan Seibert <stan@mtrr.org> | 2012-01-13 11:47:35 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2021-05-09 08:42:38 -0700 |
commit | 3076e6b2032d0acbd44966a9428fdc6de1bbcf3b (patch) | |
tree | 76cf64c8ddecf48ae300ec22d38741e71f25d343 | |
parent | 3961d2b3aa0b0b0783ddd1138556c374a2731e9e (diff) | |
download | chroma-3076e6b2032d0acbd44966a9428fdc6de1bbcf3b.tar.gz chroma-3076e6b2032d0acbd44966a9428fdc6de1bbcf3b.tar.bz2 chroma-3076e6b2032d0acbd44966a9428fdc6de1bbcf3b.zip |
Add md5() hash method to chroma.geometry.Mesh
-rw-r--r-- | chroma/geometry.py | 7 |
1 files changed, 7 insertions, 0 deletions
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 |