mkFractalSra

[ XITE Reference Manual | XITE home ]

Name

mkFractalSra - make fractal brownian motion noise

Syntax

 #include <xite/fractal.h>

 IBAND mkFractalSra( double D, int xpow,
    int ypow, double mean, double cstdev,
    double stdev );

Description

Generates fractional brownian motion noise based on the fractal dimension D as input. The algorithm is known as "Successive Random Addition" The generated band will have horizontal size 2**xpow + 1 and vertical size 2**ypow + 1.

 D        - fractional dimension (between 2.0 and 3.0)
 xpow     - horizontal size: 2**xpow + 1
 ypow     - vertical size: 2**ypow + 1
 mean     - mean pixel value for corners
 cstdev   - standard deviation for corners
 stdev    - initial standard deviation for the rest
            of the image

Note that mean far from 128 combined with large standard deviations will give a lot of over/under-flows, and a very poor result. cstdev should be small to avoid "tilting" the whole image.

Return value

The generated band

Error handling

return (IBAND)0 in case of error:
 Couldn't allocate memory
 D not between 2.0 and 3.0
 xpow or ypow below 1
 mean outside 0.0 .. 255.0
 negative cstdev or stdev

Example

 IBAND b;
 b = mkFractalSra(2.5, 7, 8, 100.0, 5.0, 25.0)

Reference

Fournier, A., Fussel, D., and Carpenter, L.
"Computer rendering of stochastic models", Commun. ACM 25, 6 (June 1982), 372-382.

See also

mkFractalSra(1)

Author

Håvard Iversen, BLAB, Ifi, UiO

Modifyed by

Tor Lønnestad, BLAB, Ifi, UiO

Id

$Id: mkFractalSra.c,v 1.29 1997/03/07 12:51:50 svein Exp $