From: Michael Z. K. <mz...@an...> - 2001-07-16 04:34:39
|
Everyone, Attached is a python module, based on povexport, which will export a VPython scene into VRML97 (2.0). Feel free to integrate this into the VPython package and/or post on the VPython webpage. Everything is implemented except convex objects, text, textures, lighting, and camera positions. Right now curves look like crap and I think I'll need to come up with some interpolation code. Arrows are currently implemented as cylinders and cones instead of boxes and pyramids. VRML has no primative for toruses (rings) but the code uses extrusions to make a torus (the only problem being rendering is slower since an extrusion is madup of a bunch of smaller shapes). Included in the file are routines to convert axis/angle rotations to quaternions (originally I was planning to implement them to combine rotations) and I have left them in there for future use. The code is call-compatible with povexport, if you pass an inc list to it it will ignore it (same with the Shadowless flag). The only thing you haev to cahnge is the import string from "import povexport" to "import vrmlexport" and the calling code from "povexport.export(..." to "vrmlexport.export(..." The code itself has been tested on a couple of the demos, the electromagnetic wave problem from 33-132 at CMU, and a VPython model of the G0 Detector being installed at Jefferson Lab (I wrote this myself and it included nested frames with rotations and was what I used to initially test my code). VRML can be easily imported to other 3D rendering software (and then back into povray, I think). Also VRML can be embedded in webpages which might be good for class webpages, etc. Cheers, Michael Katz-Hyman |