Ticket #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: | 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
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
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')
Note: See
TracTickets for help on using
tickets.

