On Sep 25, 6:32 pm, William Stein <[email protected]> wrote:
> On Fri, Sep 25, 2009 at 6:01 PM, Peter <[email protected]> wrote:
>
> > Hi,
>
> > I really like the canvas3d plot option in 4.1.2 since it will make it
> > easier to implement interactive 3d scenes in Sage and make them also
> > display in browsers that do not support java. I modified the
> > canvas3d_lib.js file so that it can also be used in a plain html page
> > and works on the iPhone and in IE.
>
> > A small hack also makes the view angle similar to the one for jmol
> > (and the parameters have been adjusted to reduce the fisheye effect).
>
> > A demo is athttp://mathcs.chapman.edu/~jipsen/canvas/sage/
>
> WOW!  I just tried that with my iPhone, and it is extremely impressive
> seeing interactive 3d Sage graphics on the iPhone.  Very cool.
>
>
>
> > and the js file can be downloaded from that page (put it in devel/sage/
> > sage/server/notebook/templates and restart the server to try it out
> > with sage-4.1.2.alpha).
>
> > Is anyone working on rendering surfaces with shading over the
> > wireframe?
>
> No.  Is it possible?
>
> > Also I noticed that the line(...) command does not seem to work with
> > the canvas3d option.
>
> Can you implement it?   It would be great if more work could be done
> on this.   Bill Cauchois -- a UW undergrad -- did a short summer
> project with me in which he implemented the current canvas rendering,
> but I don't think he plans to do much more on it.
>
> William


Digging around in plot3d, it looks like the Line object does not have
a json_repr method and so does not know how to be displayed by the
canvas3d viewer option. One simple workaround is to specify a radius
for the line, then it is rendered as a 3d object using a wireframe
cylinder with (lots of) vertices.

But solid lines (with thickness) are faster to display in the 3d
scene, so I wrote a provisional json_repr method for the Line object.
This requires extending the json format to allow for lines rather than
only for surfaces. Currently a json object that has only a list of
vertices (and no faces attribute) is assumed to represent a sequence
of line segments.

A patch for Sage-4.1.2.alpha is at 
http://mathcs.chapman.edu/~jipsen/canvas/sage/canvas3dmods.patch

and a demo of the line command is at 
http://mathcs.chapman.edu/~jipsen/canvas/sage/

Any feedback is appreciated. If this is useful, it probably needs a
trac_ticket, but currently I have no experience with this.


Rendering surfaces with shading is possible, as shown by the Pre3d
library. It is a bit slower and won't match the smoothing of jmol or
the raytracing of tachyon, but it is interactive and works without
plugins. I will try to adapt Pre3d.js to the json format and see if it
can be used from within Sage. The Pre3d license seems to be less
restrictive than GPL2, but someone who knows more about this should
look at the pre3d.js file at http://github.com/deanm/pre3d and let me
know if it can be used with Sage.

--Peter
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to