I spent a lot of time writing the java3d stuff for Sage this summer,  
but haven't had a chance to work on it much since then. I am hoping  
to get back to it a bit this Christmas break (coming up in a week for  
me). I'm excited to see the sudden interest in this.

On Dec 3, 2007, at 9:04 PM, William Stein wrote:

> On Dec 3, 2007 8:44 PM, Nils Bruin <[EMAIL PROTECTED]> wrote:
>>
>> OK, I finally found some instructions that looked halfway  
>> trustworthy.
>>
>> https://java3d.dev.java.net/binary-builds.html
>>
>> has a readme for 1.5.1 that had relatively easy to follow
>> instructions. These actually worked! I've been able to view the  
>> little
>> "capeman" in a "java applet window" (I guess it doesn't do  
>> inlining in
>> the web page yet?)

My first prototype was inlined into webpages, and the inline OpenGL- 
accelerated window didn't always play nice with the page it was  
embedded into. Also, there were issues of having many copies in the  
same page and it drained the CPU at 100% just to have it sit there  
(so when you had many plots open it was a bad situation).

The current version in Sage, however, is a total re-write and  
hopefully won't have any of these problems if I try and embed it.

>> In order to save people the trouble next time, I'll put an easily
>> found search string here:
>>
>> In order to get Java3d working with sage in your browser, you have to
>> install the Java3d extension that can be found on "https://
>> java3d.dev.java.net/binary-builds.html". Follow the instructions in
>> the README posted there to install the Java3d extension in your local
>> java installation.

In principle it should be able to download the necessary jars without  
the user having to install anything (beyond Java itself). This is why  
the initial download is so large. Obviously there are robustness  
issues. Also, it should be possible to install the necessary jars and  
a lightweight version of the applet could then be used, and jar  
caching needs to improve too.

I plan to make an option to fire up a window from the command line  
too (which one could use from the notebook too to get around all the  
https/certificate/applet/signed-jar issues).

I am glad you were able to get it to work after all, and thanks for  
the instructions.

>> After that, the following actually works:
>>
>> 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.show()

[...]

> Here is a nice test of rotating lots of spheres all at once:
>
> sage: from sage.plot.plot3d.shapes import *
> sage: from sage.plot.plot3d.plot3d import plot3d
> sage: S = Sphere(.5, color='yellow')
> sage: for i in range(200): S += Sphere(.45,
> color='red').translate(randint(-5,5),randint(-5,5),randint(-5,5))
> sage: S.show()
>
> Again, on my machine at least it feels very fast.   It's this sort of
> robustness and speed
> even for complicated scenes that I think is critical to success.

It should be noted that each of these "spheres" is actually hundreds  
of triangles, so it's doing more than one would even at first  
suppose. It is even snappier to do something like

sage: from sage.plot.plot3d.platonic import *
sage: S = Icosahedron(color='yellow')
sage: for i in range(200): S += Dodecahedron(color='red').scale 
(0.4).translate(randint(-5,5),randint(-5,5),randint(-5,5))
sage: S.show()


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to