double Perlin2D::getPerlin(int x, int y){
    double somme = 0;
    double p = 1;
    int f = 1;
    int i;

    for(i = 0 ; i < m_nbOctave ; ++i) {
        somme += p * fonction_bruit2D(x * f, y * f);
        p *= m_persistance;
        f *= 2;
    }
    return somme * (1 - m_persistance) / (1 - p);
}
Esempio n. 2
0
double		bruit_coherent2D(double x, double y, t_n2D *N2D)
{
  double	somme;
  double	p;
  int		f;
  int		i;

  somme = 0;
  p = 1;
  f = 1;
  i = 0;
  while (i < OCTAVES)
    {
      somme += p * fonction_bruit2D(x * f, y * f, N2D);
      p *= PERSISTANCE;
      f *= 2;
      i++;
    }
  return (somme * (1 - PERSISTANCE) / (1 - p));
}