コード例 #1
0
    def get_faces(self):
        for i, j in combinations(range(len(self.active)), 2):
            f0 = []
            m = self.cox_mat[i][j]
            parabolic = (i, j)
            if self.active[i] and self.active[j]:
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k))
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k + (i, )))
            elif self.active[i] and m > 2:
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (j, i) * k))
            elif self.active[j] and m > 2:
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k))
            else:
                continue

            coset_reps = set([
                self.G.get_coset_representative(w, parabolic, True)
                for w in self.words
            ])
            flist = []
            for word in self.G.sort_words(coset_reps):
                f = tuple(self.G.move(self.vtable, v, word) for v in f0)
                if None not in f and not helpers.check_duplicate_face(
                        f, flist):
                    flist.append(f)

            self.face_indices[(i, j)] = flist

        self.num_faces = sum(len(L) for L in self.face_indices.values())
コード例 #2
0
ファイル: models.py プロジェクト: whitefirer/pywonderland
    def get_faces(self):
        for i, j in combinations(self.symmetry_gens, 2):
            f0 = []  # the base face that contains the initial vertex
            if self.active[i] and self.active[j]:
                fgens = [(i, j)]
                for k in range(self.coxeter_matrix[i][j]):
                    f0.append(self._move(0, (i, j) * k))
                    f0.append(self._move(0, (j, ) + (i, j) * k))
            elif self.active[i] and self.coxeter_matrix[i][j] > 2:
                fgens = [(i, j), (i, )]
                for k in range(self.coxeter_matrix[i][j]):
                    f0.append(self._move(0, (i, j) * k))
            elif self.active[j] and self.coxeter_matrix[i][j] > 2:
                fgens = [(i, j), (j, )]
                for k in range(self.coxeter_matrix[i][j]):
                    f0.append(self._move(0, (i, j) * k))
            else:
                continue

            ftable = CosetTable(self.symmetry_gens, self.symmetry_rels, fgens)
            ftable.run()
            words = ftable.get_words()
            flist = []
            for word in words:
                f = tuple(self._move(v, word) for v in f0)
                if not helpers.check_duplicate_face(f, flist):
                    flist.append(f)
            self.face_indices.append(flist)
            self.face_coords.append(
                [tuple(self.vertex_coords[x] for x in face) for face in flist])

        self.num_faces = sum([len(flist) for flist in self.face_indices])
コード例 #3
0
ファイル: models.py プロジェクト: tuchang/pywonderland
    def get_faces(self):
        orbits = (tuple(self._move(0, (0,) * k) for k in range(self.rotations[(0,)])),
                  tuple(self._move(0, (2,) * k) for k in range(self.rotations[(2,)])),
                  (0, self._move(0, (2,)), self._move(0, (0, 2))))
        for f0 in orbits:
            flist = []
            for word in self._vwords:
                f = tuple(self._move(v, word) for v in f0)
                if not helpers.check_duplicate_face(f, flist):
                    flist.append(f)
            self.face_indices.append(flist)
            self.face_coords.append([tuple(self.vertex_coords[v] for v in face) for face in flist])

        self.num_faces = sum([len(flist) for flist in self.face_indices])
コード例 #4
0
    def get_faces(self):
        """
        Basically speaking, for a pair (i, j), the composition of the i-th and the j-th
        reflection is a rotation which fixes a base face `f0` of type `ij`. But there
        are some cases need to be considered:

        1. The i-th and the j-th mirror are both active: in this case the rotation indeed
           generates a face `f0` and edges of type `i` and type `j` occur alternatively in it.

        2. Exactly one of the i-th and the j-th mirror is active: in this case we should check
           whether their reflections commute or not: the rotation generates a face `f0` only when
           these two reflections do not commute, and `f0` contains edges of only one type.

        3. Neither of them is active: in this case there are no faces.
        """
        for i, j in combinations(self.symmetry_gens, 2):
            # the base face that contains the initial vertex
            f0 = []
            if self.active[i] and self.active[j]:
                fgens = [(i, j)]
                for k in range(self.coxeter_matrix[i][j]):
                    f0.append(self._move(0, (i, j) * k))
                    f0.append(self._move(0, (j, ) + (i, j) * k))
            elif self.active[i] and self.coxeter_matrix[i][j] > 2:
                fgens = [(i, j), (i, )]
                for k in range(self.coxeter_matrix[i][j]):
                    f0.append(self._move(0, (i, j) * k))
            elif self.active[j] and self.coxeter_matrix[i][j] > 2:
                fgens = [(i, j), (j, )]
                for k in range(self.coxeter_matrix[i][j]):
                    f0.append(self._move(0, (i, j) * k))
            else:
                continue

            ftable = CosetTable(self.symmetry_gens, self.symmetry_rels, fgens)
            ftable.run()
            words = ftable.get_words()
            flist = []
            for word in words:
                f = tuple(self._move(v, word) for v in f0)
                # the rotation fixes this face but it shifts the ordered tuple of vertices
                # rotationally, so we need to remove the duplicates.
                if not helpers.check_duplicate_face(f, flist):
                    flist.append(f)
            self.face_indices.append(flist)
            self.face_coords.append(
                [tuple(self.vertex_coords[x] for x in face) for face in flist])

        self.num_faces = sum([len(flist) for flist in self.face_indices])
コード例 #5
0
ファイル: models.py プロジェクト: jmcclenon/pywonderland
    def get_faces(self):
        """
        This method computes the indices and coordinates of all faces.

        The composition of the i-th and the j-th reflection is a rotation
        which fixes a base face f. The stabilizing group of f is generated
        by (i, j) or [(i,), (j,)] depends on whether the two mirrors are both
        active or exactly one of them is active and the they are not perpendicular
        to each other.
        """
        for i, j in combinations(self.symmetry_gens, 2):
            f0 = []
            m = self.coxeter_matrix[i][j]
            if self.active[i] and self.active[j]:
                fgens = [(i, j)]
                for k in range(m):
                    # rotate the base edge m times to get the base f,
                    # where m = self.coxeter_matrix[i][j]
                    f0.append(self.move(0, (i, j) * k))
                    f0.append(self.move(0, (j,) + (i, j) * k))
            elif self.active[i] and m > 2:
                fgens = [(i,), (j,)]
                for k in range(m):
                    f0.append(self.move(0, (i, j) * k))
            elif self.active[j] and m > 2:
                fgens = [(i,), (j,)]
                for k in range(m):
                    f0.append(self.move(0, (i, j) * k))
            else:
                continue

            ftable = CosetTable(self.symmetry_gens, self.symmetry_rels, fgens)
            ftable.run()
            words = ftable.get_words()
            flist = []
            for word in words:
                f = tuple(self.move(v, word) for v in f0)
                if not helpers.check_duplicate_face(f, flist):
                    flist.append(f)

            self.face_indices.append(flist)
            self.face_coords.append([tuple(self.vertex_coords[x] for x in face)
                                     for face in flist])

        self.num_faces = sum([len(flist) for flist in self.face_indices])
コード例 #6
0
ファイル: tiling.py プロジェクト: w3tty/pywonderland
    def get_faces(self):
        for i, j in combinations(self.gens, 2):
            c0 = self.triangle_verts[self.vertex_at_mirrors(i, j)]
            f0 = []
            m = self.cox_mat[i][j]
            H = (i, j)
            type = 0
            if self.active[i] and self.active[j]:
                type = 1
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k))
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k + (i, )))
            elif self.active[i] and m > 2:
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (j, i) * k))
            elif self.active[j] and m > 2:
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k))
            else:
                continue

            reps = set(
                self.G.get_coset_representative(w, H) for w in self.words)
            reps = self.G.sort_words(reps)
            flist = []
            for word in reps:
                f = tuple(self.G.move(self.vtable, v, word) for v in f0)
                if None not in f and not helpers.check_duplicate_face(
                        f, flist):
                    center = self.transform(word, c0)
                    coords = [self.vertices_coords[k] for k in f]
                    face = DihedralFace(word, f, center, coords, type)
                    flist.append(face)

            self.face_indices[(i, j)] = flist

        self.num_faces = sum(len(L) for L in self.face_indices.values())
コード例 #7
0
    def get_faces(self):
        for i, j in combinations(range(len(self.active)), 2):
            f0 = []
            m = self.cox_mat[i][j]
            parabolic = (i, j)
            P1 = P2 = None
            c0 = self.fundamental_triangle[2 * (i + j) % 3]
            if self.active[i] and self.active[j]:
                P1 = self.edge_points[i]
                P2 = self.edge_points[j]
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k))
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k + (i, )))
            elif self.active[i] and m > 2:
                P1 = self.edge_points[i]
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (j, i) * k))
            elif self.active[j] and m > 2:
                P2 = self.edge_points[j]
                for k in range(m):
                    f0.append(self.G.move(self.vtable, 0, (i, j) * k))
            else:
                continue

            coset_reps = set([
                self.G.get_coset_representative(w, parabolic, True)
                for w in self.words
            ])
            flist = []
            for word in self.G.sort_words(coset_reps):
                f = tuple(self.G.move(self.vtable, v, word) for v in f0)
                if None not in f and not helpers.check_duplicate_face(
                        f, flist):
                    center = self.transform(word, c0)
                    coords = [self.vertices_coords[k] for k in f]
                    coords2 = rot(coords)
                    if P1 is None or P2 is None:
                        mids = [
                            helpers.normalize((P + Q) / 2)
                            for P, Q in zip(coords, coords2)
                        ]
                        domain1 = [(V, P) for V, P in zip(coords, mids)]
                        domain2 = [(P, V) for P, V in zip(mids, coords2)]
                    else:
                        mids1 = [
                            helpers.normalize((P + Q) / 2)
                            for P, Q in zip(coords[::2], coords[1::2])
                        ]
                        mids2 = [
                            helpers.normalize((P + Q) / 2)
                            for P, Q in zip(coords[1::2], rot(coords[::2]))
                        ]
                        domain1 = [
                            (Q1, V, Q2)
                            for Q1, V, Q2 in zip(mids1, coords[1::2], mids2)
                        ]
                        domain2 = [(Q1, V, Q2) for Q1, V, Q2 in zip(
                            mids2, rot(coords[::2]), rot(mids1))]

                    if len(word) % 2 == 1:
                        domain1, domain2 = domain2, domain1

                    face = Face(word, center, coords, domain1, domain2)
                    flist.append(face)

            self.face_indices[(i, j)] = flist

        self.num_faces = sum(len(L) for L in self.face_indices.values())