You are here

Writing Mathlets II: A Call to Math Professionals - Coming in the Next Article

Author(s): 
Tom Leathrum

The next article in this series will address some more advanced features of three-dimensional graphics, in particular how surfaces in space are presented in a graph. Our first applet shows the surface given by \(z = (x^2 - y^2)/8\), a hyperbolic paraboloid, using a wireframe presentation in which the surface appears to be transparent. Parts of the surface that are farther away from the viewer appear faded to a lighter color -- this is based on a common artistic trick, of fading or blurring objects in the background while keeping foreground objects sharp and high-contrast.

In the applet shown here, the same surface is presented along with the surface \(z = (x^2 + y^2)/4 - 5\), a circular paraboloid, but now in a faceted presentation in which the surfaces appear to be opaque, so that foreground parts of the surfaces actually conceal background parts. As shown, the facets are triangular and are large enough that the intersection between the surfaces is imprecise. Again, background parts are faded, but now only to be sure that foreground and background parts are not exactly the same color. The problem is how to determine when one facet is in front of another. The general technique is to sort the facets from back to front and draw them in that order, opaquely, so that facets in front overdraw facets in back. But the sorting may not work out well if the facets are irregularly shaped or if they intersect in some way -- in the applet, facets in one surface intersect facets in the other surface in ways that present such problems.

More precise graphs showing intersections of surfaces can be drawn by subdividing the facets when they intersect, but computing such subdivisions may be too complex to be handled feasibly in an environment such as the Java runtime bytecode interpreter. More powerful three-dimensional graphing packages, such as the Java3d extensions, implement these routines using fast native binary code. The applets here do not use native binary code, so certain compromises must be made. The next article will consider the motivations and consequences of those compromises, including some interesting three-dimensional polygon geometry and a taste of computational complexity.

Tom Leathrum, "Writing Mathlets II: A Call to Math Professionals - Coming in the Next Article," Convergence (November 2004)