

def __new__(cls, corners, faces=[], pgroup=[]):
    '\n        The constructor of the Polyhedron group object.\n\n        It takes up to three parameters: the corners, faces, and\n        allowed transformations.\n\n        The corners/vertices are entered as a list of arbitrary\n        expressions that are used to identify each vertex.\n\n        The faces are entered as a list of tuples of indices; a tuple\n        of indices identifies the vertices which define the face. They\n        should be entered in a cw or ccw order; they will be standardized\n        by reversal and rotation to be give the lowest lexical ordering.\n        If no faces are given then no edges will be computed.\n\n            >>> from sympy.combinatorics.polyhedron import Polyhedron\n            >>> Polyhedron(list(\'abc\'), [(1, 2, 0)]).faces\n            {(0, 1, 2)}\n            >>> Polyhedron(list(\'abc\'), [(1, 0, 2)]).faces\n            {(0, 1, 2)}\n\n        The allowed transformations are entered as allowable permutations\n        of the vertices for the polyhedron. Instance of Permutations\n        (as with faces) should refer to the supplied vertices by index.\n        These permutation are stored as a PermutationGroup.\n\n        Examples\n        ========\n\n        >>> from sympy.combinatorics.permutations import Permutation\n        >>> Permutation.print_cyclic = False\n        >>> from sympy.abc import w, x, y, z\n\n        Here we construct the Polyhedron object for a tetrahedron.\n\n        >>> corners = [w, x, y, z]\n        >>> faces = [(0, 1, 2), (0, 2, 3), (0, 3, 1), (1, 2, 3)]\n\n        Next, allowed transformations of the polyhedron must be given. This\n        is given as permutations of vertices.\n\n        Although the vertices of a tetrahedron can be numbered in 24 (4!)\n        different ways, there are only 12 different orientations for a\n        physical tetrahedron. The following permutations, applied once or\n        twice, will generate all 12 of the orientations. (The identity\n        permutation, Permutation(range(4)), is not included since it does\n        not change the orientation of the vertices.)\n\n        >>> pgroup = [Permutation([[0, 1, 2], [3]]),                       Permutation([[0, 1, 3], [2]]),                       Permutation([[0, 2, 3], [1]]),                       Permutation([[1, 2, 3], [0]]),                       Permutation([[0, 1], [2, 3]]),                       Permutation([[0, 2], [1, 3]]),                       Permutation([[0, 3], [1, 2]])]\n\n        The Polyhedron is now constructed and demonstrated:\n\n        >>> tetra = Polyhedron(corners, faces, pgroup)\n        >>> tetra.size\n        4\n        >>> tetra.edges\n        {(0, 1), (0, 2), (0, 3), (1, 2), (1, 3), (2, 3)}\n        >>> tetra.corners\n        (w, x, y, z)\n\n        It can be rotated with an arbitrary permutation of vertices, e.g.\n        the following permutation is not in the pgroup:\n\n        >>> tetra.rotate(Permutation([0, 1, 3, 2]))\n        >>> tetra.corners\n        (w, x, z, y)\n\n        An allowed permutation of the vertices can be constructed by\n        repeatedly applying permutations from the pgroup to the vertices.\n        Here is a demonstration that applying p and p**2 for every p in\n        pgroup generates all the orientations of a tetrahedron and no others:\n\n        >>> all = ( (w, x, y, z),                     (x, y, w, z),                     (y, w, x, z),                     (w, z, x, y),                     (z, w, y, x),                     (w, y, z, x),                     (y, z, w, x),                     (x, z, y, w),                     (z, y, x, w),                     (y, x, z, w),                     (x, w, z, y),                     (z, x, w, y) )\n\n        >>> got = []\n        >>> for p in (pgroup + [p**2 for p in pgroup]):\n        ...     h = Polyhedron(corners)\n        ...     h.rotate(p)\n        ...     got.append(h.corners)\n        ...\n        >>> set(got) == set(all)\n        True\n\n        The make_perm method of a PermutationGroup will randomly pick\n        permutations, multiply them together, and return the permutation that\n        can be applied to the polyhedron to give the orientation produced\n        by those individual permutations.\n\n        Here, 3 permutations are used:\n\n        >>> tetra.pgroup.make_perm(3) # doctest: +SKIP\n        Permutation([0, 3, 1, 2])\n\n        To select the permutations that should be used, supply a list\n        of indices to the permutations in pgroup in the order they should\n        be applied:\n\n        >>> use = [0, 0, 2]\n        >>> p002 = tetra.pgroup.make_perm(3, use)\n        >>> p002\n        Permutation([1, 0, 3, 2])\n\n\n        Apply them one at a time:\n\n        >>> tetra.reset()\n        >>> for i in use:\n        ...     tetra.rotate(pgroup[i])\n        ...\n        >>> tetra.vertices\n        (x, w, z, y)\n        >>> sequentially = tetra.vertices\n\n        Apply the composite permutation:\n\n        >>> tetra.reset()\n        >>> tetra.rotate(p002)\n        >>> tetra.corners\n        (x, w, z, y)\n        >>> tetra.corners in all and tetra.corners == sequentially\n        True\n\n        Notes\n        =====\n\n        Defining permutation groups\n        ---------------------------\n\n        It is not necessary to enter any permutations, nor is necessary to\n        enter a complete set of transformations. In fact, for a polyhedron,\n        all configurations can be constructed from just two permutations.\n        For example, the orientations of a tetrahedron can be generated from\n        an axis passing through a vertex and face and another axis passing\n        through a different vertex or from an axis passing through the\n        midpoints of two edges opposite of each other.\n\n        For simplicity of presentation, consider a square --\n        not a cube -- with vertices 1, 2, 3, and 4:\n\n        1-----2  We could think of axes of rotation being:\n        |     |  1) through the face\n        |     |  2) from midpoint 1-2 to 3-4 or 1-3 to 2-4\n        3-----4  3) lines 1-4 or 2-3\n\n\n        To determine how to write the permutations, imagine 4 cameras,\n        one at each corner, labeled A-D:\n\n        A       B          A       B\n         1-----2            1-----3             vertex index:\n         |     |            |     |                 1   0\n         |     |            |     |                 2   1\n         3-----4            2-----4                 3   2\n        C       D          C       D                4   3\n\n        original           after rotation\n                           along 1-4\n\n        A diagonal and a face axis will be chosen for the "permutation group"\n        from which any orientation can be constructed.\n\n        >>> pgroup = []\n\n        Imagine a clockwise rotation when viewing 1-4 from camera A. The new\n        orientation is (in camera-order): 1, 3, 2, 4 so the permutation is\n        given using the *indices* of the vertices as:\n\n        >>> pgroup.append(Permutation((0, 2, 1, 3)))\n\n        Now imagine rotating clockwise when looking down an axis entering the\n        center of the square as viewed. The new camera-order would be\n        3, 1, 4, 2 so the permutation is (using indices):\n\n        >>> pgroup.append(Permutation((2, 0, 3, 1)))\n\n        The square can now be constructed:\n            ** use real-world labels for the vertices, entering them in\n               camera order\n            ** for the faces we use zero-based indices of the vertices\n               in *edge-order* as the face is traversed; neither the\n               direction nor the starting point matter -- the faces are\n               only used to define edges (if so desired).\n\n        >>> square = Polyhedron((1, 2, 3, 4), [(0, 1, 3, 2)], pgroup)\n\n        To rotate the square with a single permutation we can do:\n\n        >>> square.rotate(square.pgroup[0])\n        >>> square.corners\n        (1, 3, 2, 4)\n\n        To use more than one permutation (or to use one permutation more\n        than once) it is more convenient to use the make_perm method:\n\n        >>> p011 = square.pgroup.make_perm([0, 1, 1]) # diag flip + 2 rotations\n        >>> square.reset() # return to initial orientation\n        >>> square.rotate(p011)\n        >>> square.corners\n        (4, 2, 3, 1)\n\n        Thinking outside the box\n        ------------------------\n\n        Although the Polyhedron object has a direct physical meaning, it\n        actually has broader application. In the most general sense it is\n        just a decorated PermutationGroup, allowing one to connect the\n        permutations to something physical. For example, a Rubik\'s cube is\n        not a proper polyhedron, but the Polyhedron class can be used to\n        represent it in a way that helps to visualize the Rubik\'s cube.\n\n        >>> from sympy.utilities.iterables import flatten, unflatten\n        >>> from sympy import symbols\n        >>> from sympy.combinatorics import RubikGroup\n        >>> facelets = flatten([symbols(s+\'1:5\') for s in \'UFRBLD\'])\n        >>> def show():\n        ...     pairs = unflatten(r2.corners, 2)\n        ...     print(pairs[::2])\n        ...     print(pairs[1::2])\n        ...\n        >>> r2 = Polyhedron(facelets, pgroup=RubikGroup(2))\n        >>> show()\n        [(U1, U2), (F1, F2), (R1, R2), (B1, B2), (L1, L2), (D1, D2)]\n        [(U3, U4), (F3, F4), (R3, R4), (B3, B4), (L3, L4), (D3, D4)]\n        >>> r2.rotate(0) # cw rotation of F\n        >>> show()\n        [(U1, U2), (F3, F1), (U3, R2), (B1, B2), (L1, D1), (R3, R1)]\n        [(L4, L2), (F4, F2), (U4, R4), (B3, B4), (L3, D2), (D3, D4)]\n\n        Predefined Polyhedra\n        ====================\n\n        For convenience, the vertices and faces are defined for the following\n        standard solids along with a permutation group for transformations.\n        When the polyhedron is oriented as indicated below, the vertices in\n        a given horizontal plane are numbered in ccw direction, starting from\n        the vertex that will give the lowest indices in a given face. (In the\n        net of the vertices, indices preceded by "-" indicate replication of\n        the lhs index in the net.)\n\n        tetrahedron, tetrahedron_faces\n        ------------------------------\n\n            4 vertices (vertex up) net:\n\n                 0 0-0\n                1 2 3-1\n\n            4 faces:\n\n            (0, 1, 2) (0, 2, 3) (0, 3, 1) (1, 2, 3)\n\n        cube, cube_faces\n        ----------------\n\n            8 vertices (face up) net:\n\n                0 1 2 3-0\n                4 5 6 7-4\n\n            6 faces:\n\n            (0, 1, 2, 3)\n            (0, 1, 5, 4) (1, 2, 6, 5) (2, 3, 7, 6) (0, 3, 7, 4)\n            (4, 5, 6, 7)\n\n        octahedron, octahedron_faces\n        ----------------------------\n\n            6 vertices (vertex up) net:\n\n                 0 0 0-0\n                1 2 3 4-1\n                 5 5 5-5\n\n            8 faces:\n\n            (0, 1, 2) (0, 2, 3) (0, 3, 4) (0, 1, 4)\n            (1, 2, 5) (2, 3, 5) (3, 4, 5) (1, 4, 5)\n\n        dodecahedron, dodecahedron_faces\n        --------------------------------\n\n            20 vertices (vertex up) net:\n\n                  0  1  2  3  4 -0\n                  5  6  7  8  9 -5\n                14 10 11 12 13-14\n                15 16 17 18 19-15\n\n            12 faces:\n\n            (0, 1, 2, 3, 4) (0, 1, 6, 10, 5) (1, 2, 7, 11, 6)\n            (2, 3, 8, 12, 7) (3, 4, 9, 13, 8) (0, 4, 9, 14, 5)\n            (5, 10, 16, 15, 14) (6, 10, 16, 17, 11) (7, 11, 17, 18, 12)\n            (8, 12, 18, 19, 13) (9, 13, 19, 15, 14)(15, 16, 17, 18, 19)\n\n        icosahedron, icosahedron_faces\n        ------------------------------\n\n            12 vertices (face up) net:\n\n                 0  0  0  0 -0\n                1  2  3  4  5 -1\n                 6  7  8  9  10 -6\n                  11 11 11 11 -11\n\n            20 faces:\n\n            (0, 1, 2) (0, 2, 3) (0, 3, 4)\n            (0, 4, 5) (0, 1, 5) (1, 2, 6)\n            (2, 3, 7) (3, 4, 8) (4, 5, 9)\n            (1, 5, 10) (2, 6, 7) (3, 7, 8)\n            (4, 8, 9) (5, 9, 10) (1, 6, 10)\n            (6, 7, 11) (7, 8, 11) (8, 9, 11)\n            (9, 10, 11) (6, 10, 11)\n\n        >>> from sympy.combinatorics.polyhedron import cube\n        >>> cube.edges\n        {(0, 1), (0, 3), (0, 4), \'...\', (4, 7), (5, 6), (6, 7)}\n\n        If you want to use letters or other names for the corners you\n        can still use the pre-calculated faces:\n\n        >>> corners = list(\'abcdefgh\')\n        >>> Polyhedron(corners, cube.faces).corners\n        (a, b, c, d, e, f, g, h)\n\n        References\n        ==========\n\n        [1] www.ocf.berkeley.edu/~wwu/articles/platonicsolids.pdf\n\n        '
    faces = [minlex(f, directed=False, is_set=True) for f in faces]
    (corners, faces, pgroup) = args = [Tuple(*a) for a in (corners, faces, pgroup)]
    obj = Basic.__new__(cls, *args)
    obj._corners = tuple(corners)
    obj._faces = FiniteSet(*faces)
    if (pgroup and (f[0].size != len(corners))):
        raise ValueError('Permutation size unequal to number of corners.')
    obj._pgroup = PermutationGroup((pgroup or [Perm(range(len(corners)))]))
    return obj

dataset/ETHPy150Open sympy/sympy/sympy/combinatorics/polyhedron.py Polyhedron.__new__/VarMisuse@109/5464 `pgroup`->`f`