libtcoddocumentation

9.4. Getting fbm noise

This function returns the fbm function value between -1.0 and 1.0 at given coordinates, using fractal hurst and lacunarity defined when the generator has been created.

float TCODNoise::getFbm(float *f, float octaves, TCOD_noise_type_t type = TCOD_NOISE_DEFAULT)

float TCOD_noise_get_fbm(TCOD_noise_t noise, float *f, float octaves)
float
TCOD_noise_get_fbm(TCOD_noise_t noise, float *f, float octaves, TCOD_noise_type_t type)

noise_get_fbm(noise, f, octaves, type=NOISE_DEFAULT)

float TCODNoise::getBrownianMotion(float[] f, float octaves, type=NoiseDefault)

ParameterDescription
noiseIn the C version, the generator handler, returned by the initialization function.
fAn array of coordinates, depending on the generator dimensions (between 1 and 4). The same array of coordinates will always return the same value.
octavesNumber of iterations. Must be < TCOD_NOISE_MAX_OCTAVES = 128
typeThe algorithm to use. If not defined, use the default one (set with setType or simplex if not set)
Example:

// 1d fbm
TCODNoise * noise1d = new TCODNoise(1);
float
p=0.5f;
// get a 1d simplex fbm
float value = noise1d->getFbm(&p,32.0f);
// 2d fbm
TCODNoise * noise2d = new TCODNoise(2);
float
p[2]={0.5f,0.7f};
// get a 2d perlin fbm
float value = noise2d->getFbm(p,32.0f, TCOD_NOISE_PERLIN);

// 1d fbm
TCOD_noise_t noise1d = TCOD_noise_new(1,TCOD_NOISE_DEFAULT_HURST, TCOD_NOISE_DEFAULT_LACUNARITY,NULL);
float
p=0.5f;
// get a 1d simplex fbm
float value = TCOD_noise_get_fbm(noise1d,&p,32.0f);
// 2d fbm
TCOD_noise_t noise2d = TCOD_noise_new(2,TCOD_NOISE_DEFAULT_HURST, TCOD_NOISE_DEFAULT_LACUNARITY,NULL);
float
p[2]={0.5f,0.7f};
// get a 2d perlin fbm
float value = TCOD_noise_get_fbm_ex(noise2d,p,32.0f,TCOD_NOISE_PERLIN);

# 1d noise
noise1d = libtcod.noise_new(1)
# 1d simplex fbm
value = libtcod.noise_get_fbm(noise1d,[0.5],32.0)
# 2d noise
noise2d = libtcod.noise_new(2)
# 2d perlin fbm
value = libtcod.noise_get_fbm(noise2d,[0.5,0.7],32.0, libtcod.NOISE_PERLIN)