- Membership
- MAA Press
- Meetings
- Competitions
- Community
- Programs
- Students
- High School Teachers
- Faculty and Departments
- Underrepresented Groups
- MAA Awards
- MAA Grants

- News
- About MAA

As mentioned in the introduction, it is not necessary to use Mathematica to develop mathlets with LiveGraphics3D. Theoretically, as long as you have a knowledge of Mathematica's syntax, you can create LiveGraphics3D input files from scratch using any text editor. However, few of us have the patience to calculate 400 vertices, let alone type out a list of 400 polygons, just to display a surface. Realistically, even if you do not use Mathematica, you will still want to avoid creating your input by hand.

One possibility is to create your graphics using some other application, and then use a special program to convert the results into a LiveGraphics3D input file. Two examples of such tools are:

- Amar Junankar's "LiveGraphics3D Projects" page (Junankar) includes a program to convert STL (stereolithography) files into LiveGraphics3D input files.
- LiveTranslate (Kayll, et al.), which is still in development, translates VRML output into LiveGraphics3D input files. This was originally written as a way to use LiveGraphics3D with Maple, which can export graphics to VRML files, but should function with VRML output from any other program as well.

If neither of these tools is suitable, you can use nearly any computer language to produce the input for LiveGraphics3D. The only key is to mimic Mathematica's output. For example, recall the following piece of Mathematica code which was used to construct a cross section of a surface on this earlier page.

```
(* "xmin," "xmax," "dx," etc. were defined earlier.*)
f[x_,y_]= 2y*Exp[-x^2-y^2];
ySection = {RGBColor[0, 0, 1], Thickness[0.005],
Table[Line[{{i, y, f[i, y]},
{i + dx, y, f[i + dx, y]}}],
{i, xmin, xmax - dx, dx}]};
```

To create this output with another language, we can simply use a loop to construct the string

{RGBColor[0., 0., 1.], Thickness[0.005], Line[{{-1., y, 2.*2.718^(-1. - 1.*y^2)*y}, {-0.8, y, 2.*2.718^(-0.64 - 1.*y^2)*y}}], ... }

This can be accomplished by implementing the following pseudo-code; here string means a function which takes a number and turns it into a string:

input = "{RGBColor[0, 0, 1], Thickness[0.005]," let i loop from xmin to xmax with stepsize dx if this is not the first polygon, then input = input + "," segment = "Line[{" +"{"+string(i)+", y, 2*y*Exp[-"+string(i^2)+"-y2]}," +"{"+string(i+dx)+", y, 2*y*Exp[-"+string((i+dx)^2)+"-y2]}" +"}]" input = input + segment end of loop input = input + "}"

While it might seem inelegant to piece together a Mathematica-style list in this manner, the difficulties are easy to overcome. One of us has created a stand-alone application version of the "Interactive Gallery of Quadric Surfaces," which appeared in this journal as a suite of mathlets on web pages (Rogness, 2005). The application version computes all of the inputs for the parametrized graphics in the gallery at runtime using `for`

loops as described here.

JavaScript is also readily adaptable to this purpose, and provides an opportunity for a truly interactive experience. For example, you can create a web page with a form which allows a student to enter the equations for a parametric surface; the JavaScript code which parses the student's input can also generate the corresponding graph using LiveGraphics3D. Try this basic demonstration.

For another example, see Amar Junankar's web page, mentioned above. It includes a "Parametric Curve Generator" which allows users to enter the parametric equations of a curve into an HTML form. The page then uses JavaScript to produce the input for LiveGraphics3D, and the curve is displayed in a pop-up window.

Jonathan Rogness and Martin Kraus, "Constructing Mathlets Quickly using LiveGraphics3D - Generating Input without Mathematica," *Convergence* (May 2006)

Journal of Online Mathematics and its Applications