The Mathematica Journal
Download This Issue
Feature Articles
Graphics Gallery
Tricks of the Trade
In and Out
The Mathematica Programmer
New Products
New Publications
News Bulletins
Editor's Pick
Write Us
About the Journal
Staff and Contributors
Back Issues

The Water

The water consists of a river and a waterfall, both of which are colored blue. The river is formed by straight and helical sections of a piecewise continuous surface. A parabolic surface forms the waterfall. The waterfall is positioned so that it appears to connect to the ends of the river in the finished animation.  Motion of the water is suggested by translating the mesh on the surface of both the waterfall and the river.

We need to construct a function that gives the position of the river as a function of the horizontal distance along the path p and width q off the centerline of the river. The path is either straight or helical with breakpoints at the following locations along the path of the surface.


The half-width of the river is


The breakpoints of each segment are multiples of pi. Since the helical segments have a centerline radius of 1, they may also be used as a measure of rotation about the vertical axis. The helical segments of the path are defined using the following rotation matrix, in which th is the angle about the vertical. It rotates a vector about the vertical axis.


The path of the river is defined in several parts.


The animation runs from 0 to 1 in time. The river "flows" to give a visual cue to aid in the illusion of the continuous downhill motion. Flow of the river is suggested by translating the mesh on the surface of the river. This translation is accomplished by shifting the plotting range by one polygon over the animation cycle. Since in the definition of rpath we truncated the range to be between pp3 and pm3, the effect at t=0 will be to have a row of polygons with zero length in the [Graphics:../Images/index_gr_17.gif] direction at pp3. As time increases, so will the length of the first row of polygons. At the same time, the last row of polygons will shrink until they have zero length at the end of the animation cycle.

The number of (whole) polygons in the [Graphics:../Images/index_gr_18.gif] direction is


The "velocity" of the river is calculated by dividing the length of one row of polygons by the time increment (one).


A blue color scheme is used for the river except where the lower end of the waterfall intercepts it. There the color is white to suggest whitewater. The color scheme is implemented by using the color directive Hue and varying the saturation as a decaying exponential along the path.


The function river creates the graphics with rcolor appended to rpath.


Here is a plot of the river.



Figure 2.

Figure 2 doesn't look like much when viewed at the default viewpoint, but if we view it from a greater distance and along the [Graphics:../Images/index_gr_25.gif] axis, the similarity to the shoebox example in the introduction starts to become clear. The straight legs of the river are equivalent to the horizontal boxes, and when we add the waterfall it will be equivalent to the vertical box. An elevation (el) of [Graphics:../Images/index_gr_26.gif] above the horizontal is chosen for the viewpoint for aesthetic reasons.



Figure 3.

Converted by Mathematica      September 24, 1999 [Prev Page][Next Page]