How does it work?
Shapes of mountains and clouds are really fractals of a certain
kind if you think in general enough terms:
A fractal is geometric shape that can be subdivided in
parts, each of which is (at least approximately) a
reduced-size copy of the whole.
Looking in nature, the shapes of mountains and clouds fit this
definition. As you see in the applet above, it is possible to model
their shapes and evolution quite well by using a simple algorithm which literally
creates a fractal pattern.
The generation algorithm is almost the same as for mountains as for
clouds. Both of them are generated by a recursive procedure that
picks random values for the corners of some simple shape. Using those
values, the polygon is "fractured". Since each of the fractured
pieces is approximately a reduced-size copy of the original shape, we
can repeat the procedure by further fracturing the pieces, and so on.
The main difference between the cloud algorithm and the mountain
algorithm is that the
fractured shape for mountain generation is a triangle and each value
stands for altitude, whereas the fractured shape for clouds is a rectangle
and each node's value should be transformed to color. Random values
are averaged with nearest nodes' values so both rock surface and
clouds look sufficiently smooth.
More details, references and software
are available online.
What is going on?
At the top part of the applet there is a panel containing
three groups of check boxes (such grouped check boxes are known
as option buttons or radio buttons).
1. The first group
includes two buttons, labeled Run
and Stop . We can use
these buttons for running and stopping the animation.
2. The second group has
label Degree and includes
three buttons labeled 5, 6 and 7
respectively. Degree stands for degree of number
2 and this value corresponds with the number of segments each
side of primary triangle or rectangle is divided to.
Each next degree corresponds with two times more number of
segments and four times more number of triangles and rectangles
then previous one.
3. The third group has
label Light and includes two buttons labeled Rear
and Front respectively. Each of them sets its
own (rear and front) direction of lighting.