def __init__(self, p, q, r, path): self.path = path label = "-".join([str(d) for d in reversed(path)]) self.label = label if label == "": self.gon = poincare.polygon(poincare.origin, verticeCount=p, radius=r) else: if label in gons: self.gon = copy.copy(gons[label]).gon else: gonIter = gonClass(p, q, r, path[1:]) self.gon = gonIter.gon.getMirror(int(path[0])) self.color = colorFromZ(self.gon.center.z, self.path) if path: d = path[0] else: d = 1 self.direction = np.imag(np.log(self.gon.center.z**p))
def getGon(p, q, r, label): if label == []: return poincare.polygon(poincare.origin, verticeCount=p, radius=r) else: iter = getGon(p, q, r, label[1:]) return iter.getMirror(int(label[0]))
# print gon, gonNew, gon.color, color pImg.drawPolygon(gonNew, color=color, offset=multiplier) return pImg p = poincare.p q = poincare.q zerolabels = [i + 1 for i in range(p)] t1 = 1 - np.tan(np.pi / p) * np.tan(np.pi / q) t2 = 1 + np.tan(np.pi / p) * np.tan(np.pi / q) gonRadius = np.sqrt(t1 / t2) gonFundamental = poincare.polygon(poincare.origin, verticeCount=5, radius=gonRadius) gons = {} gons[""] = gonClass(p, q, gonRadius, []) depth = poincare.depth for i in range(depth): iterLabels(i) print[label for label in gons] gonsTable = [gons[l] for l in gons] gonsTable.sort(key=lambda x: x.direction) print[g.label for g in gonsTable] ims = [] ims2 = []