def __cmp__(self, other): """Compare points for sort ordering in an arbitrary heirarchy.""" longzip = ziplong(self._values, other, fillvalue=0.0) for v1, v2 in reversed(list(longzip)): val = cmp(v1, v2) if val != 0: return val return 0
def __cmp__(self, p): """Compare points for sort ordering in an arbitrary heirarchy.""" longzip = ziplong(self._values, p, fillvalue=0.0) for v1, v2 in reversed(list(longzip)): val = v1 - v2 if val != 0: val /= abs(val) return val return 0
def __cmp__(self, other): """Compare faces for sorting in an arbitrary heirarchy.""" cl1 = [sorted(v[i] for v in self.vertices) for i in range(3)] cl2 = [sorted(v[i] for v in other.vertices) for i in range(3)] for i in reversed(range(3)): for c1, c2 in ziplong(cl1[i], cl2[i]): if c1 is None: return -1 val = cmp(c1, c2) if val != 0: return val return 0