Ticket #12950: trac_12950-revolution_plot3d.patch

File trac_12950-revolution_plot3d.patch, 1.5 KB (added by jpflori, 8 years ago)

Fix for revolution_plot3d

  • sage/plot/plot3d/revolution_plot3d.py

    # HG changeset patch
    # User Jean-Pierre Flori <jean-pierre.flor@ssi.gouv.fr>
    # Date 1337793906 -7200
    # Node ID d0a5c76505d257da0ca3ad976114da524f80be0f
    # Parent  3ffe805bcae22f459550805ac4a48b3d49a61a92
    Trac #12950: Handle axis=(0,0) separately in revolution_plot3d
    
    diff --git a/sage/plot/plot3d/revolution_plot3d.py b/sage/plot/plot3d/revolution_plot3d.py
    a b  
    154154    if parallel_axis=='z':
    155155        x0=axis[0]
    156156        y0=axis[1]
    157         phase=atan2((y-y0),(x-x0))
     157        # (0,0) must be handled separately for the phase value
     158        phase=0
     159        if x0!=0 or y0!=0:
     160            phase=atan2((y-y0),(x-x0))
    158161        R=sqrt((x-x0)**2+(y-y0)**2)
    159162        v=(R*cos(phi+phase)+x0,R*sin(phi+phase)+y0,z)
    160163    elif parallel_axis=='x':
    161164        y0=axis[0]
    162165        z0=axis[1]
    163         phase=atan2((z-z0),(y-y0))
     166        # (0,0) must be handled separately for the phase value
     167        phase=0
     168        if z0!=0 or y0!=0:
     169            phase=atan2((z-z0),(y-y0))
    164170        R=sqrt((y-y0)**2+(z-z0)**2)
    165171        v=(x,R*cos(phi+phase)+y0,R*sin(phi+phase)+z0)
    166172    elif parallel_axis=='y':
    167173        x0=axis[0]
    168174        z0=axis[1]
    169         phase=atan2((z-z0),(x-x0))
     175        # (0,0) must be handled separately for the phase value
     176        phase=0
     177        if z0!=0 or x0!=0:
     178            phase=atan2((z-z0),(x-x0))
    170179        R=sqrt((x-x0)**2+(z-z0)**2)
    171180        v=(R*cos(phi+phase)+x0,y,R*sin(phi+phase)+z0)
    172181