The Mathematica Journal
Departments
Download This Issue
Home
Feature Articles
Graphics Gallery
Tricks of the Trade
In and Out
Columns
The Mathematica Programmer
New Products
New Publications
Classifieds
Calendar
News Bulletins
Editor's Pick
Mailbox
Letters
Write Us
About the Journal
Staff and Contributors
Submissions
Subscriptions
Advertising
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.

[Graphics:../Images/index_gr_7.gif]

The half-width of the river is

[Graphics:../Images/index_gr_8.gif]

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.

[Graphics:../Images/index_gr_9.gif]

The path of the river is defined in several parts.

[Graphics:../Images/index_gr_10.gif]
[Graphics:../Images/index_gr_11.gif]
[Graphics:../Images/index_gr_12.gif]
[Graphics:../Images/index_gr_13.gif]
[Graphics:../Images/index_gr_14.gif]
[Graphics:../Images/index_gr_15.gif]
[Graphics:../Images/index_gr_16.gif]

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

[Graphics:../Images/index_gr_19.gif]

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

[Graphics:../Images/index_gr_20.gif]

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.

[Graphics:../Images/index_gr_21.gif]

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

[Graphics:../Images/index_gr_22.gif]

Here is a plot of the river.

[Graphics:../Images/index_gr_23.gif]

[Graphics:../Images/index_gr_24.gif]

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.

[Graphics:../Images/index_gr_27.gif]
[Graphics:../Images/index_gr_28.gif]
[Graphics:../Images/index_gr_29.gif]

[Graphics:../Images/index_gr_30.gif]

Figure 3.


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