This function returns the perlin noise function value between -1.0 and 1.0 at given coordinates.
C++ : float TCODNoise::getPerlin(float *f) const
C : float TCOD_noise_perlin(TCOD_noise_t noise, float *f)
Py : noise_perlin(noise, f)
Parameter | Description |
noise | In the C version, the generator handler, returned by the initialization function. |
f | An array of coordinates, depending on the generator dimensions (between 1 and 4). The same array of coordinates will always return the same value. |
Example :
C++ : // 1d noise
TCODNoise * noise1d = new TCODNoise(1);
float p=0.5f;
float value = noise1d->getPerlin(&p);
// 2d noise
TCODNoise * noise2d = new TCODNoise(2);
float p[2]={0.5f,0.7f};
float value = noise2d->getPerlin(p);
C : /* 1d noise */
TCOD_noise_t noise1d = TCOD_noise_new(1,TCOD_NOISE_DEFAULT_HURST, TCOD_NOISE_DEFAULT_LACUNARITY,NULL);
float p=0.5f;
float value = TCOD_noise_perlin(noise1d,&p);
/* 2d noise */
TCOD_noise_t noise2d = TCOD_noise_new(2,TCOD_NOISE_DEFAULT_HURST, TCOD_NOISE_DEFAULT_LACUNARITY,NULL);
float p[2]={0.5f,0.7f};
float value = TCOD_noise_perlin(noise2d,p);
Py : # 1d noise
noise1d = libtcod.noise_new(1)
value = libtcod.noise_perlin(noise1d,[0.5])
# 2d noise
noise2d = libtcod.noise_new(2)
value = libtcod.noise_perlin(noise2d,[0.5,0.7])
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.
C++ : float TCODNoise::getFbmPerlin(float *f, float octaves) const
C : float TCOD_noise_fbm_perlin(TCOD_noise_t noise, float *f, float octaves)
Py : noise_fbm_perlin(noise, f, octaves)
Parameter | Description |
noise | In the C version, the generator handler, returned by the initialization function. |
f | An array of coordinates, depending on the generator dimensions (between 1 and 4). The same array of coordinates will always return the same value. |
octaves | Number of iterations. Must be < TCOD_NOISE_MAX_OCTAVES = 128 |
Example :
C++ : // 1d fbm
TCODNoise * noise1d = new TCODNoise(1);
float p=0.5f;
float value = noise1d->getFbmPerlin(&p,32.0f);
// 2d fbm
TCODNoise * noise2d = new TCODNoise(2);
float p[2]={0.5f,0.7f};
float value = noise2d->getFbmPerlin(p,32.0f);
C : /* 1d fbm */
TCOD_noise_t noise1d = TCOD_noise_new(1,TCOD_NOISE_DEFAULT_HURST, TCOD_NOISE_DEFAULT_LACUNARITY,NULL);
float p=0.5f;
float value = TCOD_noise_fbm_perlin(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};
float value = TCOD_noise_fbm_perlin(noise2d,p,32.0f);
Py : # 1d noise
noise1d = libtcod.noise_new(1)
value = libtcod.noise_fbm_perlin(noise1d,[0.5],32.0)
# 2d noise
noise2d = libtcod.noise_new(2)
value = libtcod.noise_fbm_perlin(noise2d,[0.5,0.7],32.0)
This function returns the turbulence function value between -1.0 and 1.0 at given coordinates, using fractal hurst and lacunarity defined when the generator has been created.
C++ : float TCODNoise::getTurbulencePerlin(float *f, float octaves) const
C : float TCOD_noise_turbulence_perlin(TCOD_noise_t noise, float *f, float octaves)
Py : noise_turbulence_perlin(noise, f, octaves)
Parameter | Description |
noise | In the C version, the generator handler, returned by the initialization function. |
f | An array of coordinates, depending on the generator dimensions (between 1 and 4). The same array of coordinates will always return the same value. |
octaves | Number of iterations. Must be < TCOD_NOISE_MAX_OCTAVES = 128 |
Example :
C++ : // 1d fbm
TCODNoise * noise1d = new TCODNoise(1);
float p=0.5f;
float value = noise1d->getTurbulencePerlin(&p,32.0f);
// 2d fbm
TCODNoise * noise2d = new TCODNoise(2);
float p[2]={0.5f,0.7f};
float value = noise2d->getTurbulencePerlin(p,32.0f);
C : /* 1d fbm */
TCOD_noise_t noise1d = TCOD_noise_new(1,TCOD_NOISE_DEFAULT_HURST, TCOD_NOISE_DEFAULT_LACUNARITY,NULL);
float p=0.5f;
float value = TCOD_noise_turbulence_perlin(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};
float value = TCOD_noise_turbulence_perlin(noise2d,p,32.0f);
Py : # 1d noise
noise1d = libtcod.noise_new(1)
value = libtcod.noise_turbulence_perlin(noise1d,[0.5],32.0)
# 2d noise
noise2d = libtcod.noise_new(2)
value = libtcod.noise_turbulence_perlin(noise2d,[0.5,0.7],32.0)