Ejemplo n.º 1
0
double		fonction_bruit2D(double x, double y, t_n2D *N2D)
{
  t_dble	stdb;
  int		i;
  int		j;

  i = (int)(x / PAS);
  j = (int)(y / PAS);
  stdb.a = bruit2D(i, j, N2D);
  stdb.b = bruit2D(i + 1, j, N2D);
  stdb.c = bruit2D(i, j + 1, N2D);
  stdb.d = bruit2D(i + 1, j + 1, N2D);
  x = fmod(x / PAS, 1);
  y = fmod(y / PAS, 1);
  return (interpolation_cos2D(&stdb, x, y));
}
Ejemplo n.º 2
0
double Perlin2D::fonction_bruit2D(int x, int y) {
   int i = (int) (x / m_step);
   int j = (int) (y / m_step);
   return interpolation_cos2D(noise(i, j), noise(i + 1, j), noise(i, j + 1), noise(i + 1, j + 1), fmod(x / m_step, 1), fmod(y / m_step, 1));
}