LiveGraphics3D Setup

Prepared by the METRIC Project for the Chemistry Maths Lab 1998-9.

Version 1.1 (01/07/99, modified for a new version of the LiveGraphics applet, v. -0.70).

LiveGraphics3D is a Java "applet" (program) that you can use via a web browser to interactively view Mathematica 3-D graphics.

LiveGraphics3D was created by Martin Kraus, University of Erlangen.
  Website: http://theorie3.physik.uni-erlangen.de/~mkraus/Live.html

Instructions

To set up the definitions contained in this notebook, select 
Evaluation -> Evaluate Initialization 
from the Kernel menu.

Function definitions

The following two definitions should be evaluated.

Options[WriteLiveForm] = {
        JavaCodebase -> "http://metric.ma.ic.ac.uk/java", 
        ImageSize -> {300, 300}};

\(WriteLiveForm[filename_, \ g_, \ opts___]\  := \ 
      Module[{javacodebase, isize}, 
        \((
			\ {javacodebase, isize} = 
            \({JavaCodebase, ImageSize} /. {opts}\) /. 
              Options[WriteLiveForm]; 
\ \ \ \ \ \ \ \ 
          WriteString[filename, \ 
				
            "<HTML><APPLET CODEBASE=""<>javacodebase<>
              "" ARCHIVE="live.jar" CODE="Live.class" WIDTH="<>
              ToString[isize[\([1]\)]]<>" HEIGHT="<>
              ToString[isize[\([2]\)]]<>">
     <PARAM NAME=BGCOLOR VALUE=#FFFFFF>
     <PARAM NAME=MAGNIFICATION VALUE=1.>
     <PARAM NAME=INPUT VALUE=""<>
\ \ \ \ \ \ \ \ 
              ToString[NumberForm[InputForm[N[g]], \ 5]]<>
				
              ""></APPLET></HTML>"]; 
\ \ \ \ \ \ \ \ Close[filename])
          \)]\)

Testing

If you have problems with creating and viewing LiveGraphics3D images, please contact
p.kent@ic.ac.uk. For the technically-minded, there is a documentation page at:

http://theorie3.physik.uni-erlangen.de/~mkraus/documentation.html

Testing your browser

Test if your browser is properly "Java-enabled" by going to

http://metric.ma.ic.ac.uk/chem/orbital1.html

If your browser is working, you should be able to rotate (drag the mouse) and zoom in and out of this molecular orbital image (hold the shift key and drag the mouse down or up).

If your browser is NOT Java-enabled, check in the following locations: 
    Netscape version 4: Edit menu -> Preferences -> Advanced 
    Netscape version 3: Options menu -> Network preferences -> Languages 
    Internet Explorer 4: Edit menu -> Preferences ->Web-browser - Java 
    Internet Explorer 3: View menu -> Options -> Security

Testing the WriteLiveForm function

Here's a sample image (extracted from Maths Lab session 2):

Needs["Graphics`ParametricPlot3D`"]

\(orbitaltest = 
      SphericalPlot3D[\ Abs[Cos[θ]], {θ, 0, π}, 
        \ {ϕ, \ 0, \ \ 2\ π}, Boxed -> False, 
		Axes -> False, 
        PlotPoints -> 25, \ AmbientLight -> RGBColor[0.6, \ 0, \ 0.1]]\)

Now do:

WriteLiveForm["orbitaltest.html", orbitaltest]

This creates a file called "orbitaltest.html" containing a Java version of your graphic (the filename is arbitrary, but should always end in ".html" or ".htm"). You should note that as written, the file will be placed in the "working directory". The command

Directory[]

will show what this is and you can use SetDirectory to change it.

To view a Java file, the menu paths differ in different browser versions - in Netscape look for "File - Open Page" or "File - Open - Page in Navigator"; in Internet Explorer look for "File - Open - Browse" or "File - Open File" .

Now locate "orbitaltest.html". All being well, your graphic should soon appear: just drag the mouse to rotate, and with the shift key pressed, drag down or up to zoom in or out.

You can change the size of the Java image using the ImageSize option, for example:

WriteLiveForm["orbitaltest.html", orbitaltest, 
      ImageSize -> {500, 500}]

Installing LiveGraphics3D locally ( = using it without a network connection)

If you do

Options[WriteLiveForm]

you will see that by default the LiveGraphics HTML files call up the special Java files from METRIC's web site, "metric.ma.ic.ac.uk/java". In fact, the Java files can be put anywhere, including locally on the hard disk of the machine you are working on. This will be of particular interest if you are using a computer outside of the Imperial College networks.

The first thing to do is to get a copy of the "jar" archive file which contains the LiveGraphics applet code. Go to

http://metric.ma.ic.ac.uk/java

and download and "Save as..." the file live.jar. This is a binary file, so will just be full of squiggles if you look inside it (note: be sure to use binary mode if you move it around using ftp).

On a Windows machine, you might install live.jar in a folder such as
    "C:\Program Files\LiveGraphics3D\"
and then you would use the following option to WriteLiveForm:

JavaCodebase -> "file:///C|/Program Files/LiveGraphics3D/"