예제 #1
0
파일: disc.py 프로젝트: punkdit/bruhat
 def show_point(self, z, fill_attrs=None, stroke_attrs=None, radius=0.05):
     z = self.g_center(z)
     r = 2. / d_poincare(z)
     p = path.circle(z.real, z.imag, radius * r)
     if fill_attrs is not None:
         self.cvs.fill(p, fill_attrs)
     if stroke_attrs is not None:
         self.cvs.stroke(p, stroke_attrs + [normal * r])
예제 #2
0
파일: disc.py 프로젝트: punkdit/bruhat
 def show_qubit(self, z, scale=None):
     cvs = self.cvs
     x, y = z.real, z.imag
     if scale is None:
         scale = 1.5 / d_poincare(z)
     p = path.circle(x, y, 0.05 * scale)
     cvs.fill(p, [white])
     cvs.fill(p, [black.alpha(0.1)])
     cvs.stroke(p, [black, normal * scale])
예제 #3
0
파일: disc.py 프로젝트: punkdit/bruhat
 def show_polygon(self, pts, st_stroke=[], st_fill=None):  # XXX broken XXX
     cvs = self.cvs
     n = len(pts)
     z = sum(pts) / n
     # sometimes these geodesics are reversed XXX
     items = [self.get_geodesic(pts[i], pts[(i + 1) % n]) for i in range(n)]
     #        for item in items:
     #            if isinstance(item, LineGeodesic):
     #                #print(item.z0, item.z1)
     #                #st_fill = [grey]
     #                cvs.stroke(item.p, [thin])
     #            else:
     #                cvs.stroke(item.p, [thin])
     #        return
     items = [item.p for item in items]
     items.append(path.closepath())
     p = path.path(items)
     if st_fill is not None:
         self.cvs.fill(p, st_fill)
     r = 2. / d_poincare(z)
     #if isinstance(p[0], path.line):
     cvs.stroke(p, st_stroke + [r * normal])
예제 #4
0
파일: disc.py 프로젝트: punkdit/bruhat
    def show_tiles(self, G):
        # -----------------------------------------------------------
        # draw pentagons & qubits
        N = 5
        #edge = [(conv(j/(N-1), 0., z3.real), 0.) for j in range(N)]
        edge = [(conv(j / (N - 1), 0., z2.real), 0.) for j in range(N)]
        for g in G:
            #print("trace:", g.trace, "fixed:", g.fixed())
            #assert g.is_sl()
            assert g.is_su()
            #self.cvs.fill(path.circle(x1, y1, 0.01), [green])

            g2 = self.g_center * g

            edge1 = [g2.trafo(*p) for p in edge]
            for idx in range(len(edge1) - 1):
                p, q = edge1[idx:idx + 2]
                lw = 2. / d_poincare(p[0] + 1.j * p[1])
                self.cvs.stroke(path.line(*p, *q), [lw * thin] + st_round)

            z = g2(z2)
            ds = 2 / (1 - z * z.conjugate()).real
            self.show_qubit(z.real, z.imag, 1.5 / ds)
예제 #5
0
파일: disc.py 프로젝트: punkdit/bruhat
    def show_bring():
        tiles = [
            (
                1,
                I,
            ),
            (
                2,
                (c**3) * a,
            ),
            (
                3,
                (c**2) * a,
            ),
            (
                4,
                c * a,
            ),
            (
                5,
                a,
            ),
            (
                6,
                (c**4) * a,
            ),
            (
                7,
                a**2,
            ),
            (
                8,
                a**3,
            ),
            (
                9,
                ci * a**2,
            ),
            (
                10,
                ci * a**3,
            ),
            (
                11,
                ci**2 * a**2,
            ),
            (7, ci**2 * a**3),
            (
                8,
                ci**3 * a**2,
            ),
            (9, ci**3 * a**3),
            (
                10,
                ci**4 * a**2,
            ),
            (11, ci**4 * a**3),
        ]
        #g = ci*a**2
        #h = ci**3*a**3
        #disc.show_fixed(h*~g)
        #bring = [I, h*~g]
        g = a**3 * b * a**-3
        a1 = g * a * ~g
        #disc.show_fixed(a1*a1)
        #assert a1.order() == 5, a1.order()
        tiles.append((11, a1**2 * a**3))
        tiles.append((9, a1**4 * a**3))

        for (count, g) in tiles:
            #if count == 5:
            #    g = (tx0**-3)*g
            for h in bring:
                g2 = disc.g_center * h * g
                z = g2(z1)
                ds = 1. / d_poincare(z)**0.7
                if ds > 0.05:
                    cvs.text(z.real, z.imag, str(count),
                             [Scale(ds)] + st_center)
예제 #6
0
파일: disc.py 프로젝트: punkdit/bruhat
 def show_label(self, z, label, scale=1.0):
     cvs = self.cvs
     x, y = z.real, z.imag
     scale = scale * 2.5 / d_poincare(z)
     if scale > 1e-5:
         cvs.text(x, y, label, [Scale(scale)] + st_center)
예제 #7
0
파일: disc.py 프로젝트: punkdit/bruhat
 def show_geodesic(self, z0, z1, attrs=[]):
     "show_geodesic between two points"
     z0, z1 = self.g_center(z0), self.g_center(z1)
     gamma = Geodesic.construct(z0, z1)
     r = 2. / d_poincare(gamma.z2)
     self.cvs.stroke(gamma.p, attrs + [r * normal])
예제 #8
0
파일: disc.py 프로젝트: punkdit/bruhat
 def d_poincare(self, z):
     g = self.g_center
     return d_poincare(g(z))