Ticket #1511 (closed enhancement: fixed)

Opened 5 years ago

Last modified 5 years ago

[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: Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description

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

Attachments

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

Change History

comment:1 Changed 5 years ago by robertwb

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

comment:2 Changed 5 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 5 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 5 years ago by robertwb

comment:4 Changed 5 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 5 years ago by robertwb

See #1516 for future work.

comment:6 Changed 5 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 5 years ago by was

  • Milestone changed from sage-2.9.1 to sage-2.9

Changed 5 years ago by was

comment:8 Changed 5 years ago by mabshoff

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

Merged in 2.9.rc2.

Note: See TracTickets for help on using tickets.