< index
< 10. Noise generator
< 10.2 Getting Perlin noise

=====================================
10.3 Getting simplex noise
=====================================

> 10.4 Getting wavelet noise
This function returns the simplex noise function value between -1.0 and 1.0 at given coordinates.
The simplex noise is much faster than Perlin, especially in 4 dimensions. It has a better contrast too.

C++ : float TCODNoise::getSimplex(float *f) const
C   : float TCOD_noise_simplex(TCOD_noise_t noise, float *f)
Py  : noise_simplex(noise, f)

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.

Example :

C++ : // 1d noise
      TCODNoise * noise1d = new TCODNoise(1);
      float p=0.5f;
      float value = noise1d->getSimplex(&p);
      // 2d noise
      TCODNoise * noise2d = new TCODNoise(2);
      float p[2]={0.5f,0.7f};
      float value = noise2d->getSimplex(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_simplex(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_simplex(noise2d,p);
Py  : # 1d noise 
      noise1d = libtcod.noise_new(1)
      value = libtcod.noise_simplex(noise1d,[0.5])
      # 2d noise
      noise2d = libtcod.noise_new(2)
      value = libtcod.noise_simplex(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::getFbmSimplex(float *f, float octaves) const
C   : float TCOD_noise_fbm_simplex(TCOD_noise_t noise, float *f, float octaves)
Py  : noise_fbm_simplex(noise, f, octaves)

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

Example :

C++ : // 1d fbm
      TCODNoise * noise1d = new TCODNoise(1);
      float p=0.5f;
      float value = noise1d->getFbmSimplex(&p,32.0f);
      // 2d fbm
      TCODNoise * noise2d = new TCODNoise(2);
      float p[2]={0.5f,0.7f};
      float value = noise2d->getFbmSimplex(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_simplex(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_simplex(noise2d,p,32.0f);
Py  : # 1d noise 
      noise1d = libtcod.noise_new(1)
      value = libtcod.noise_fbm_simplex(noise1d,[0.5],32.0)
      # 2d noise
      noise2d = libtcod.noise_new(2)
      value = libtcod.noise_fbm_simplex(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::getTurbulenceSimplex(float *f, float octaves) const
C   : float TCOD_noise_turbulence_simplex(TCOD_noise_t noise, float *f, float octaves)
Py  : noise_turbulence_simplex(noise, f, octaves)

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

Example :

C++ : // 1d fbm
      TCODNoise * noise1d = new TCODNoise(1);
      float p=0.5f;
      float value = noise1d->getTurbulenceSimplex(&p,32.0f);
      // 2d fbm
      TCODNoise * noise2d = new TCODNoise(2);
      float p[2]={0.5f,0.7f};
      float value = noise2d->getTurbulenceSimplex(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_simplex(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_simplex(noise2d,p,32.0f);
Py  : # 1d noise 
      noise1d = libtcod.noise_new(1)
      value = libtcod.noise_turbulence_simplex(noise1d,[0.5],32.0)
      # 2d noise
      noise2d = libtcod.noise_new(2)
      value = libtcod.noise_turbulence_simplex(noise2d,[0.5,0.7],32.0)

insert a comment