|
Breaking Waves with Bezier Curves |
A method that can be used to generate an animation |
of a breaking wave or series of breaking waves in 2 |
dimensions is described. This is done without interpolation |
of time slices of pictures of actual breaking waves (and the |
databases necessary for their storage.) |
There are three main ways of generating curves: |
Bezier, Hermite and Natural Spline. The Hermite |
method might be suitable for mimicking the motion |
of 'big pipe' waves found in Hawaii, but for |
garden variety waves, their control points would |
sometimes be off the screen and thus difficult to |
manipulate. The Natural Spline method was rejected |
in favour of the Bezier method because some of |
the Bezier control points remain co-linear through |
the wave's breaking cycle, simplifying calculations. |
Take a Bezier curve that has four control points: |
two endpoints and two points not on the curve that |
determine the curve's shape. When two such Bezier curves |
are joined, sharing an endpoint and sharing a control |
point as shown in the diagram, one has the basis for a |
breaking wave. The shared endpoint is 3, the shared |
control point is 1. To make the wave break, points |
2,3, and 4 are rotated 90 degrees about the midpoint, |
of the line segment between points 0 and 5. The rotation is |
clockwise if the wave is to be moving from left to right. |
It can be seen that the wave's area will not be |
conserved during this rotation unless further manipulation |
is performed. This can be done by separating and moving |
the control points that make up the control points called |
one and six. The shared control point 1 can be split up: |
the point number one and six are separated. Number one, |
the back of the wave is moved up and to the left, while the |
control point belonging to the front of the wave is |
moved up and slightly to the right. These |
manipulations are for a wave moving from left to right. |
Reverse them for a wave moving from right to left. |
The center of rotation of the control points remains as the |
point mid-way between point 0 and 5. |
The crest of the wave can be varied realistically |
by altering the 'horizontal' aspect of point 4. This allows |
the generation of waves with concave leading faces. In |
practice it is easier to vary the the x value of point |
5, and then rotate all three points the required amount, |
than rotate first and then try to determine the proper |
x and y coordinates of point 5. |
Although there are uses for the animation of a |
single wave not moving across the screen, the author |
feels that the animation should be easily extensible |
to making multiple wave moving across the drawing area. |
For this, the design pattern called the Strategy Pattern |
should be used. There should be a Wave class having |
the characteristics of an individual wave in it. These |
characteristics include the control points, their starting |
values, and, in the manner of running totals: |
the angle that the control points have been rotated, |
the amount control point 5 is to be moved horizontally, |
and the amount the whole wave is to be moved horizontally. |
"Head First Design Patterns" by Eric Freeman, |
Elisabeth Freeman, Kathy Sierra, Bert Bates |
O'Reilly 2004 |
http://www.leeholmes com/projects/grapher in |
"Killer Game Programming in Java" by Andrew Davison |
O'Reilly 2005 |
"Animation and Control of Breaing Waves" by V Mihalef, |
D Metaxas, M Sussman 2004 Eurographics/ACM SIGGRAPH |
Symposium on Computer Animation , R Boulec, D K Pai |
editors, on the web at |
http://paul rutger edu/~mihalef/Breaking_Waves.pdf |
DIAGRAM |
see related web site |