r.rifs

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
NOTES
SEE ALSO
ACKNOWLEDGEMENTS
AUTHOR

NAME

r.rifs - Generates a raster map and/or graphical image of a fractal specified in terms of a random iterated function system.
(GRASS Raster Program)

SYNOPSIS

r.rifs
r.rifs help
r.rifs
[-cdost] [outputname] transformsvalue [iterationsvalue] [seedvalue] [colorname] [widthvalue] [pvalue[,value,...]] avalue[,value,...] bvalue[,value,...] cvalue[,value,...] dvalue[,value,...] evalue[,value,...] fvalue[,value,...]

DESCRIPTION

r.rifs iteratively applies Ttransforms transformations W1, W2,...,WT each with probability p1, p2,...,pT. Each transformation W is specified according to the matrix

a, b | e
c
, d | f

such that if (x,y), (x1,y1),...,(xN,yN) are the set of N transformed points then x1 = ax + by + e and y1 = cx + dy + f, etc. Note that a, b, c and d provide for linear transformations and that e and f provide for additional translation (resulting in an affine linear transformation).

If the -c flag has been set then the probablilities p1,...,pT are calculated as

max (h, | det Wi |)
p
i = ----------------------, i = 1,...,T
k=T
SUM max (h, | det Wk |)
k=1

where | det Wi | is the absolute value of ad-bc and h is a small value to replace pi that would otherwise be so close to zero that no point would ever be drawn.

OPTIONS

The program can be run non-interactively or interactively. To run r.rifs non-interactively the user must minimally specify: the number of transforms; that number of values for each of a, b, c, d, e and f; and either that same number of values for p, or the flag -c. Any remaining parameters whose values have not been specified on the command line will be set to their default values (see below).

To run r.rifs interactively the user should simply type r.rifs on the command line, in which case the program will prompt for parameter values using the standard GRASS interface described in the manual entry for parser.

Flags:

-c

Have the program calculate the transformation probablities.

-d

Display the fractal in the currently selected GRASS monitor.

-o

Overwrite the output raster map if it already exists.

-s

Run silently.

-t

Be terse about progress, confirming only the parameters.

Parameters:

outputname

Name for the raster map that will contain the newly generated fractal. This will be a binary map in which cells are coded 0 or 1.

transformsvalue

The number of transformations, W1,...,WT, required to generate the fractal (maximum of 10).

iterationsname

The number of iterations required to generate the fractal. Each transformation, W1,...,WT, is applied iterations times.

Default: 5000

seedvalue

The value with which to seed the random number generator. This option allows exact reproduction of a previous result.

Default: 1

colorname

The color in which to draw the fractal in the GRASS monitor. This may be one of: red, orange, yellow, green, blue, indigo, white, black, brown, magenta, aqua, gray, grey.

Default: magenta

widthvalue

An integer between 0 and 32767 (inclusive) describing the width of the fractal. When this is not specified the width defaults to whichever is least of the number of rows or columns in the current region. In this way the default is to ensure that the whole fractal is visible, even if that leaves large parts of the display and/or output map blank. By specifying a width which is greater than the number of rows or columns in the current region it may be possible to ’fill’ the display frame and/or output map. Note that the results are very dependent on the fractal in question: for example, this strategy works much better with the Sierpinski Gasket than it does with the Barnsley Fern.

pvalue

The probability of each of the Ttransforms transformations. These probabilities should be left unspecified only if the -c flag has been set.

avalue

The elements a1, a2,...,aT in the Ttransforms transformation matrices W1, W2,...,WT.

bvalue

The elements b1, b2,...,bT in the Ttransforms transformation matrices W1, W2,...,WT.

cvalue

The elements c1, c2,...,cT in the Ttransforms transformation matrices W1, W2,...,WT.

dvalue

The elements d1, d2,...,dT in the Ttransforms transformation matrices W1, W2,...,WT.

evalue

The elements e1, e2,...,eT in the Ttransforms transformation matrices W1, W2,...,WT.

fvalue

The elements f1, f2,...,fT in the Ttransforms transformation matrices W1, W2,...,WT.

NOTES

r.rifs works in the current geographic region with the current mask.

The probabilities and parameter values a-f can be retrieved using r.info.

The user may find the following fractals useful for studying the effect of resolution and saturation on the box-counting (fractal) dimension calculated by the GRASS program r.boxcount.

The Sierpinski Gasket can be generated with:
r.rifs -cd transforms=3 iterations=50000 a=0.5,0.5,0.5 b=0,0,0 c=0,0,0 d=.5,.5,.5 e=0,.5,0 f=0,0,.5

The Barnsley Fern can be generated with:
r.rifs -cd transforms=4 color=green iterations=50000 a=0,-.139,.17,.781 b=0,.263,-.215,.034 c=0,.246,.222,-0.032 d=.27,.224,.176,.739 e=.5,.57,.408,.1075 f=0,-0.036,0.0893,.27

A tree can be generated with:
r.rifs -cd transforms=5 iterations=50000 color=green a=0.195,0.462,-0.058,-0.035,-0.637 b=-0.488,0.414,-0.07,0.07,0.0 c=0.344,-0.252,0.453,-0.469,0.0 d=0.443,0.361,-0.111,-0.022,0.501 e=0.4431,0.2511,0.5976,0.4884,0.8562 f=0.2452,0.5692,0.0969,0.5069,0.2513/fR

SEE ALSO

r.boxcount, parser

For an introduction to random iterated function systems: Peitgen, Jurgens and Saupe, 1992, Chaos and Fractals:New Frontiers of Science, Springer-Verlag: New York. Chapts. 5 and 6.

ACKNOWLEDGEMENTS

This program was written during the author’s tenure of a Leverhulme Special Research Fellowhip.

AUTHOR

Mark Lake, Institute of Archaeology, University College London.