## Advanced Examples

Having described on the previous page how to avoid the use of Mathematica when developing input for LiveGraphics3D, we now wish to demonstrate the benefits of using Mathematica if it is available to you. The analytic geometry in complicated mathlets can quickly lead to very messy calculations with dozens of variables, multiple derivatives, cross products, and more. Human error -- not to mention boredom -- inevitably creeps in when doing these computations by hand, but they are child's play for any computer algebra system (CAS). In our experience the use of a CAS is an invaluable timesaver when creating input files, particularly those with parametrized graphics, allowing us to create quite complex mathlets with relatively few lines of code. Because LiveGraphics3D uses a subset of Mathematica's syntax, it is natural that Mathematica lends itself to this development process more than any other CAS.

If Mathematica is available on your computer, you may be interested in a package developed at the University of Minnesota which allows LiveGraphics3D to run from within Mathematica. Standard Mathematica commands like

and **Show**

are supplemented by **Animate**

and **ShowLive**

, which automatically display 3D plots, parametrized graphics, and animations using LiveGraphics3D. Contact us for details.**AnimateLive**

In this section we will show some of the mathlets we have created this way. While it should still be stressed that Mathematica was not necessary to create these examples, it sped the development process considerably. We will not discuss the code to produce these mathlets in detail since it requires more knowledge about Mathematica's programming language than we covered in this article; however, the accompanying notebook to this article contains commented Mathematica code for all the examples. Interested readers are encouraged to have a look at them using either Mathematica or the free MathReader tool (Wolfram.com).

Our first example illustrates the geometric construction of the Simson line. The Simson line is the line containing the feet of the perpendiculars from an arbitrary point on the circumcircle of a triangle to the sides or their extensions of the triangle; see MathWorld's description of "Simson Line" (Weisstein) for more information. Our mathlet lets the user define a triangle by its three vertices and automatically constructs the triangle's circumcircle. This is easily achieved by parametrizing the circumcircle by the coordinates of the triangle's vertices. Additionally, a fourth user-specified point is defined, which the mathlet projects to the nearest point on the circumcircle. Parametrized by the coordinates of these four points, the rest of the graphics specifies the perpendiculars from the point on the circumcircle to the triangle's sides, the corresponding feet, and the line connecting two of them.

As you can verify by dragging any of the four red points, the three feet are always on the constructed line, which is in fact the Simson line.

Our second example employs an animation to illustrate the definition of a spirograph, which is the trace generated by a fixed point on a circle rolling inside a fixed circle; further details can be found in MathWorld's "Spirograph" entry (Weisstein). The animation starts as soon as the mouse pointer is over the mathlet. (Some web browsers require one additional click on the mathlet.) The animation is stopped (and restarted) by double-clicking. Remember that you have to stop the animation to drag any of the three red points specifying the radii of the two circles and the distance of the traced point from the center of the rolling circle.

As you experiment with this mathlet, you might realize that it actually restricts the ratio of the radii of the two circles to certain rational numbers to guarantee a closed trace. You might also realize that the mathlet allows you to choose a greater radius for the rolling circle than for the fixed circle. Strictly speaking, this case is not covered by the definition of a spirograph given above because the rolling circle is no longer inside the fixed circle. The mathematics of the two cases is, however, almost identical apart from an interesting sign change of the time parameter, which is seldom discussed in the literature because it doesn't affect the geometry of the curve; however, for an animation this sign change is crucial.

The next two three-dimensional examples are slight adaptations of two of the over sixty mathlets from an ongoing project (Kraus) to provide interactive versions of figures featured in a book on computer-aided geometric design by Gerald Farin (Farin). These mathlets are employed in a course on geometric modelling at the University of Stuttgart. The first mathlet uses a cubic Bézier curve specified by four user-defined control vertices and one additional user-defined point specifying a curve parameter *t*. For these input parameters the Frenet frame is constructed and additional vectors corresponding to the derivatives of the axes of the Frenet frame are displayed to illustrate the Frenet-Serret formulas. (Compare with Figure 10.3 in (Farin).)

The second example illustrates the osculating circle of a curve on a surface. (Compare with Figure 19.4 in (Farin).) Three user-defined points specify a quadratic Bézier curve in the *uv* parameter space of a quadratic Bézier patch specified by nine user-defined points. Parametrized by this user input, the mathlet illustrates the osculating circle (corresponding to the actual curvature of the curve in one point) and the osculating circle of maximum radius for all curves with the same tangent direction in the same point (corresponding to the surface's normal curvature in this direction). By manipulating the quadratic Bézier curve in parameter space of the patch, one can show that the normal curvature oscillates between two extremums (the principal curvatures of the surface) as the tangent direction is rotated.

One of the features of LiveGraphics3D that has not yet been mentioned is the ability to "strip away" objects in the scene. This is accomplished by dragging downward while holding down the right mouse button. In this mathlet, you can remove the two osculating circles this way in order to explain the construction first. The osculating circles may be added again by dragging upward with the right mouse button pressed.

Next Page: Future Directions

#### Table of Contents

- Introduction
- LiveGraphics3D Overview
- LiveGraphics3D Input
- Parametrized Graphics
- Moving Lines and Polygons
- Including Text
- Labeling Axes and Plots
- Animations
- Occlusions of Objects
- Intersecting Objects
- Two-Dimensional Mathlets
- Stereo Images
- Generating Graphical Input
- Advanced Examples
- Future Directions
- References