Ticket #11272: trac_11272_cube_centre.patch

File trac_11272_cube_centre.patch, 1012 bytes (added by johanbosman, 9 years ago)
  • sage/plot/plot3d/platonic.py

    # HG changeset patch
    # User Johan Bosman <johan.g.bosman@gmail.com>
    # Date 1304420280 -3600
    # Node ID 6240bbadbb736d2e2bfada0879387433ce6c12f1
    # Parent  361a4ad7d52c69b64ae2e658ffd0820af0d87e93
    Trac 11272: compute centre of cube correctly
    
    diff -r 361a4ad7d52c -r 6240bbadbb73 sage/plot/plot3d/platonic.py
    a b  
    6969    return prep(I, center, size, kwds)
    7070
    7171def prep(G, center, size, kwds):
     72    if size != 1:
     73        G = G.scale(size)
    7274    if center != (0,0,0):
    7375        G = G.translate(center)
    74     if size != 1:
    75         G = G.scale(size)
    7676    G._set_extra_kwds(kwds)
    7777    return G
    7878
     
    218218   
    219219        sage: c.show(viewer='tachyon')
    220220   
     221    This shows #11272 has been fixed::
     222   
     223        sage: cube(center=(10, 10, 10), size=0.5).bounding_box()
     224        ((9.75, 9.75, 9.75), (10.25, 10.25, 10.25))
     225   
    221226    AUTHORS:
    222227
    223228    - William Stein