UMAP Module 741 on “Waves and Strong Tides” by L. T. King (© 1994, 1996 by COMAP, Inc., Lexington, MA) provides the background material for this assignment.
A mathematical model of a wave is an equation of the following form:
h(x, t) = h0 cos(kx – wt)
l is the wavelength or crest-to-crest distance
k = 2π/l is the wave number.
w is the frequency.
P = 2π/w is the period.
t is time in seconds.
h0 is the amplitude.
For positive w, the wave travels in the direction of increasing x; and for negative w, in the direction of decreasing x.
It can be shown that in deep water, the approximate value of k is
and in shallow water
where D is the depth of the water in meters. (9.8 is the acceleration due to gravity measured in m/sec2.)
For a wave that is rotated an angle a off the x-axis, the model of the height of the wave is a function that depends on the x and z coordinates and the time t, as follows:
y(x, z, t) = h0 cos(k (x cosa - z sina) – wt)
By the Principle of Superposition, when two waves f and g interact, the result is f + g.
1. Develop a program that displays the axes and a wire frame of one wave as one looks down the positive z axis toward the origin. Assume a deep-water wave moving in the positive x direction. Have the user enter values for w, h0, and t.
One step at a time, revise the program so that
one looks at the origin from above and to the right. What did you change?
the user also enters an angle of rotation off the x axis.
the user enters the number (1-10) of wave forms.
Have the computer generate at “random” reasonable values for w,
t, and a
for the waves and to graph the resulting sea.
the user indicates whether the sea is deep or shallow. If
shallow, the user enters the sea depth.
2. Add shading and lights to the visualization of Project 1, illustrating ambient, diffuse, and specular lighting and showing the surface with appropriate highlights. Have the polygons filled with color.
3. Add keyboard-controlled rotations to Project 2, with event-driven programming with callbacks. Enable clipping planes parallel to each axis so that the user can slice through the sea. Have a menu of choices of clipping plane, description of program, and help. Use display lists to improve performance on the display. (See Steve Cunningham's "Some Other Useful Concepts" and conicStereo.c)
4. Revise Project 2 to animate the waves.
5. Revise Project 4 to have two waves interact. Have keyboard controls to allow the user to display one random wave, another, or the interaction of both waves. Also, allow the user to designate that the second wave is identical to the first except the w values have opposite signs. What do you observe in this case?
6. Revise Project 5 to have three waves interact. Have keyboard controls to allow the user to display any one, any two, or all three waves interacting.
7. Add keyboard-controlled rotations to Project 4, with event-driven programming with callbacks. Enable clipping planes parallel to each axis so that the user can slice through the sea. Have a menu of choices of clipping plane, description of program, and help. Use display lists to improve performance on the display. (See Steve Cunningham's "Some Other Useful Concepts" and conicStereo.c)
8-14. Revise corresponding Project 1-7 assuming shallow water.