Opened 10 years ago

Closed 10 years ago

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

Reported by: Owned by: robertwb robertwb major sage-2.9 graphics

Description

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

comment:1 Changed 10 years ago by robertwb

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

comment:2 Changed 10 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 10 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')
```

```./jmol /path/to/a.script
```

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

See #1516 for future work.

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

• Milestone changed from sage-2.9.1 to sage-2.9

comment:8 Changed 10 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.