![]() | ![]() | IFSgr Library Reference Manual |
---|
ifsgr — Basic definitions and miscellaneous functions.
#define IFS_EPSILON #define IFS_PROBSTACK_BITS #define IFS_PROBSTACK #define IFS_PROBSTACK_MASK typedef PointXY; typedef IFSTrans; typedef IFS; size_t* ifs_discretize_probability (const IFS *ifs, size_t ntab, size_t *tab); void ifs_find_range (const IFS *ifs, const size_t *tab, uint64_t niter, PointXY *min, PointXY *max); void ifs_free (IFS *ifs); void ifs_normalize_probabilities (IFS *ifs);
#define IFS_EPSILON 1e-9
A small number (much smaller than 1 and much larger than machine epsilon).
#define IFS_PROBSTACK_BITS 11
The number of bits needed to represent indices in precomputed probability maps used in IFS drawing functions.
#define IFS_PROBSTACK (1UL << (IFS_PROBSTACK_BITS))
The size of precomputed probability maps used in IFS drawing functions.
#define IFS_PROBSTACK_MASK (IFS_PROBSTACK - 1UL)
Mask for clearing all but the lowest IFS_PROBSTACK_BITS bits in an integer.
typedef struct { double x, y; double xx, xy, yx, yy; double p; } IFSTrans;
Structure representing an affine two-dimensional transformation.
typedef struct { char *name; size_t n; IFSTrans *t; } IFS;
Structure representing an iterated function system.
size_t* ifs_discretize_probability (const IFS *ifs, size_t ntab, size_t *tab);
Computes transformation relative occurrence table.
Index of each transformation is present proportionally to the transformation probability. To select a random transformation with corresponding probability is thus sufficient to select a random item from the table.
ifs: | An Iterated Function System. |
ntab: | The size of ntab. |
tab: | Array to store the precomputed transformation relative occurrence table to, or NULL to allocate a new one. |
Returns : | tab itself it it was not NULL, a newly allocated array which should be freed when no longer needed otherwise. |
void ifs_find_range (const IFS *ifs, const size_t *tab, uint64_t niter, PointXY *min, PointXY *max);
Find the rectangle to which the fractal ifs fits in.
This is done simply by computing a few thousand iterations.
ifs: | An Iterated Function System. |
tab: | Precomputed probability table of size IFS_PROBSTACK. |
niter: | The number of iterations to try, when zero some reasonable built-in default is used. |
min: | Where the minimum coordinates should be stored. |
max: | Where the maximum coordinates should be stored. |
void ifs_free (IFS *ifs);
Completely frees an IFS structure.
ifs: | An Iterated Function System. |
void ifs_normalize_probabilities (IFS *ifs);
Normalize probabilitites to sum 1.0 keeping their ratios.
ifs: | An Iterated Function System. |
<< taus |