Ticket #5635: 11803.patch

File 11803.patch, 3.2 KB (added by novoselt, 4 years ago)
  • sage/geometry/lattice_polytope.py

    # HG changeset patch
    # User Andrey Novoseltsev <novoselt@gmail.com>
    # Date 1238474465 25200
    # Node ID 4190bb65ff67fc4ed8169a583d1770ed8fc072ab
    # Parent  5c72dbb92d8284101858a5e6f2b476a56e597e14
    Removed plot() for consistency (it was showing a bad 3d plot, plot3d works better).
    
    diff -r 5c72dbb92d82 -r 4190bb65ff67 sage/geometry/lattice_polytope.py
    a b  
    211211     
    212212    We draw a pretty picture of the polytype in 3-dimensional space:: 
    213213     
    214         sage: p.plot().show() 
     214        sage: p.plot3d().show() 
    215215     
    216216    Now we add an extra point, which is in the interiour of the 
    217217    polytope... 
     
    14531453        """ 
    14541454        return SetOfAllLatticePolytopes 
    14551455 
    1456     def plot(self, camera_center=None): 
    1457         """ 
    1458         Draw a 3d picture of the polytope. 
    1459          
    1460         INPUT: 
    1461          
    1462          
    1463         -  ``self`` - polytope of dimension 3. 
    1464          
    1465         -  ``camera_center`` - (default: random) location of 
    1466            center of the camera (i.e., viewer) 
    1467          
    1468          
    1469         OUTPUT: a Tachyon 3d raytracer plot of the polytope 
    1470          
    1471         The face colors are random. 
    1472          
    1473         AUTHORS: 
    1474  
    1475         - William Stein and Tom Boothby 
    1476          
    1477         EXAMPLES:: 
    1478          
    1479             sage: o = lattice_polytope.octahedron(3) 
    1480             sage: o.plot().show() 
    1481         """ 
    1482         if self.dim() != 3: 
    1483             raise ValueError, "Polytope must have dimension 3!" 
    1484         m = self._vertices 
    1485         r = random.random 
    1486         if camera_center is None: 
    1487             x = max(m.list()) 
    1488             camera_center = [(1+r())*x,(1+r())*x,(1+r())*x] 
    1489             for i in range(3): 
    1490                 if r() > 0.5: 
    1491                     camera_center[i] *= -1 
    1492         t = Tachyon(camera_center=camera_center) 
    1493         t.light(tuple([2*v for v in camera_center]), .1, (1,1,1)) 
    1494  
    1495         cols = m.columns() 
    1496         n = len(cols) 
    1497         for i in range(n): 
    1498             for j in range(i,n): 
    1499                 for k in range(j,n): 
    1500                     s = "T%010d%010d%010d"%(i,j,k) 
    1501                     t.texture(s, color=hue(r())) 
    1502                     t.triangle(cols[i],cols[j],cols[k], s) 
    1503         return t 
    1504  
    15051456    def plot3d(self, 
    15061457            show_facets=True, facet_opacity=0.5, facet_color=(0,1,0), 
    15071458            show_edges=True, edge_thickness=3, edge_color=(0.5,0.5,0.5), 
     
    16061557                pplot += text3d(i, index_shift*self.point(i), rgbcolor=pindex_color) 
    16071558        return pplot 
    16081559 
    1609     def show(self, camera_center=None): 
     1560    def show3d(self): 
    16101561        """ 
    1611         Draw a 3d picture of the polytope. 
     1562        Show a 3d picture of the polytope with default settings and without axes or frame. 
    16121563         
    1613         See self.plot? for more details. 
     1564        See self.plot3d? for more details. 
    16141565         
    16151566        EXAMPLES:: 
    16161567         
    16171568            sage: o = lattice_polytope.octahedron(3) 
    1618             sage: o.show() 
     1569            sage: o.show3d() 
    16191570        """ 
    1620         self.plot(camera_center=camera_center).show() 
     1571        self.plot3d().show(axis=False, frame=False) 
    16211572 
    16221573    def point(self, i): 
    16231574        r"""