Opened 7 years ago

Closed 7 years ago

#1511 closed enhancement (fixed)

[with patch, positive review] Export 3d objects in jmol format

Reported by: robertwb Owned by: robertwb
Priority: major Milestone: sage-2.9
Component: graphics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

http://jmol.sourceforge.net/ may be a promising answer to 3d graphics in Sage.

Attachments (2)

jmol-export.hg (3.9 KB) - added by robertwb 7 years ago.
trac-1511-update.patch (1.5 KB) - added by was 7 years ago.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 7 years ago by robertwb

  • Owner changed from was to robertwb
  • Status changed from new to assigned

comment:2 Changed 7 years ago by robertwb

  • Summary changed from Export 3d objects in jmol format to [with patch] Export 3d objects in jmol format

Bundle also contains #1473

comment:3 Changed 7 years ago by robertwb

    sage: from sage.plot.plot3d.shapes import *
    sage: from sage.plot.plot3d.plot3d import plot3d
    sage: S = Sphere(.5, color='yellow')
    sage: S += Cone(.5, .5, color='red').translate(0,0,.3)
    sage: S += Sphere(.1, color='white').translate(.45,-.1,.15) + Sphere(.05, color='black').translate(.51,-.1,.17)
    sage: S += Sphere(.1, color='white').translate(.45, .1,.15) + Sphere(.05, color='black').translate(.51, .1,.17)
    sage: S += Sphere(.1, color='yellow').translate(.5, 0, -.2)
    sage: def f(x,y): return math.exp(x/5)*math.cos(y)
    sage: P = plot3d(f,(-5,5),(-5,5), ['red','yellow'], max_depth=10)
    sage: cape_man = P.scale(.2)+S.translate(1,0,0)
    sage: cape_man.export_jmol('/path/to/a.script')

Then, after downloading jmol, do

./jmol /path/to/a.script

Changed 7 years ago by robertwb

comment:4 Changed 7 years ago by was

It works perfectly!!! Of course, it needs some doctests...

Try this out, it's awesome:

 sage: from sage.plot.plot3d.shapes import *
    sage: from sage.plot.plot3d.plot3d import plot3d
    sage: S = Sphere(.5, color='yellow')
    sage: S += Cone(.5, .5, color='red').translate(0,0,.3)
    sage: S += Sphere(.1, color='white').translate(.45,-.1,.15) + Sphere(.05, color='black').translate(.51,-.1,.17)
    sage: S += Sphere(.1, color='white').translate(.45, .1,.15) + Sphere(.05, color='black').translate(.51, .1,.17)
    sage: S += Sphere(.1, color='yellow').translate(.5, 0, -.2)
    sage: def f(x,y): return math.exp(x/5)*math.cos(y)
    sage: P = plot3d(f,(-200,20),(-200,20), ['red','yellow'], max_depth=10)
    sage: cape_man = P.scale(.2)+S.translate(1,0,0)
    sage: cape_man.export_jmol('/Users/was/sage-2.9.alpha7/jmol/a.script')

comment:5 Changed 7 years ago by robertwb

See #1516 for future work.

comment:6 Changed 7 years ago by was

  • Summary changed from [with patch] Export 3d objects in jmol format to [with patch, positive review] Export 3d objects in jmol format

Positi

comment:7 Changed 7 years ago by was

  • Milestone changed from sage-2.9.1 to sage-2.9

Changed 7 years ago by was

comment:8 Changed 7 years ago by mabshoff

  • Resolution set to fixed
  • Status changed from assigned to closed

Merged in 2.9.rc2.

Note: See TracTickets for help on using tickets.