Mathematica Graphics with JavaView
JavaView is a Java Applet that reads a text file of Mathematica graphics and allows the user to view and rotate it in real-time 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 javaview.de.
Step by Step Instruction on Using JavaView for Mathematica
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: Intro to Mathematica's 3D Graphics Format. )
The Mathematica graphics file must have the suffix “.mgs” for it to be used with JavaView.
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.
Zip Your Mathematica Graphics File
Often, a Mathematica graphic contains thousands of polygons, resulting a large file. JavaView also support reading in a zip compressed file (gzip is also supported). Suppose your Mathematica file is named “mathematica_graphics.mgs”. After you zip it, it should be named “mathematica_graphics.mgs.zip”, and the “model” parameter 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”.
Ask me question on patreon