# Composition of Functions

This category includes composition of sines and cosines (one of the x2ftp plasmas uses this), which are also used in the inverse-FFT method. Other functions which can be used include bicubic and bilinear surface patches; these are fairly straightforward, and resemble Perlin's noise function in concept. Basically you evaluate the function(s) at each surface point, adding "higher frequencies" with progressively smaller scales. Remember to reduce the amplitude of higher levels of detail, just like with subdivision.

In this method, multiple functions (usually sine or cosine) are added together to yield the height for each point. Multiple "octaves" are used, with adjustable phase and amplitude for each octave. The advantage is that the height at each location can be obtained at any time, independent of it's neighbors; the disadvantage is that the calculations are typically more expensive than subdivision methods.

Octaves
Repetition of the same function at a higher frequency. Usually, a multiple of 2 is used, but any number greater than one could be used. Also known as the 'lacunarity' of the fractal.
Phase
Where along the waveform of the function you start; typically a uniform random between zero and the wavelength (2*PI for sine or cosine)
Amplitude
The height or strength of the function. Usually the amplitude is decreased by the lacunarity with each new octave, so that if the amplitude at level 1 is 1, the amplitude at level 2 is .5, at level 3 it's .25, etc. You don't need to decrease the amplitude by the same amount as the lacunarity; the decay factor can be higher (for smoother terrain) or lower (for rougher terrain).

Advantage: with the right functions, this can be extended an indefinate distance in any direction, and the surfaces are generally smoother. Also can have better control over the basic features of the landscape.

Disadvantage: Can take lots more computation than subdivision. Can also give a repeating pattern to the landscape if you're not careful. Making the periodicity of the function (e.g., table size if you're using table lookups) prime relative to the map size.