Xah Lee, 2006-12-20
JavaView is a Java Applet that reads a text file of Mathematica graphics and allows the user to view and rotate it dynamically in a web browser. This page is a short tutorial on how to use set up JavaView to view Mathematica graphics.
JavaView is a Java applet (and application) that reads in a 3D graphics file and display it in a web browser, allowing users to rotate it, and also with the option of displaying the surface translucent or as wire-frame only.
Its home page is at http://www.javaview.de/.
First, you need to download the javaview.jar file at the JavaView website. javaview.jar is the engine that does the live rotation.
Then, you need a file of Mathematica graphics. Suppose this is your graphics file: mathematica_graphics.mgs. (if you are not familiar with Mathematica graphics see: Introduction To Mathematica's 3D Graphics Format. )
Note that, in order to use Mathematica graphics format with JavaView, the Mathematica graphics file must have the suffix “.mgs”.
Now, create a file jv-test.html with the following content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>JavaView Test</title> </head> <body> <applet codebase="./" code="javaview.class" archive="javaview.jar" width="650" height="650"> <param name="frame" value="Show"> <param name="model" value="mathematica_graphics.mgs"> <param name="panel" value="Material"> <param name="control" value="Show"> </applet> </body> </html>
Now, you are all done. Open the jv-test.html file with a web browser, and you should see your graphics in live rotation.
Often, a Mathematica graphic contains thousands of polygons, resulting a large file. JavaView also support reading in a zip or gzip compressed file. Suppose your mathematica file is named “mathematica_graphics.mgs”. After you zip it, it should be named “mathematica_graphics.mgs.zip”, and the “model” paramter should be set accordingly, like this:
<param name="model" value="mathematica_graphics.mgs.zip">
Similarly, if your file is gzipped, it should have the suffix “.mgs.gz”.
See also:
Page created: 2006-12. © 2006 by Xah Lee.