Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export 3d objects in jmol format #1511

Closed
robertwb opened this issue Dec 14, 2007 · 7 comments
Closed

Export 3d objects in jmol format #1511

robertwb opened this issue Dec 14, 2007 · 7 comments

Comments

@robertwb
Copy link
Contributor

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

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/1511

@robertwb robertwb added this to the sage-2.9.1 milestone Dec 14, 2007
@robertwb
Copy link
Contributor Author

comment:2

Bundle also contains #1473

@robertwb
Copy link
Contributor Author

comment:3
    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

@robertwb
Copy link
Contributor Author

Attachment: jmol-export.hg.gz

@williamstein
Copy link
Contributor

comment:4

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')

@robertwb
Copy link
Contributor Author

comment:5

See #1516 for future work.

@williamstein
Copy link
Contributor

comment:6

Positi

@sagetrac-mabshoff
Copy link
Mannequin

sagetrac-mabshoff mannequin commented Dec 16, 2007

comment:8

Attachment: trac-1511-update.patch.gz

Merged in 2.9.rc2.

@sagetrac-mabshoff sagetrac-mabshoff mannequin closed this as completed Dec 16, 2007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants