gradCoord2D method

double gradCoord2D(
  1. int seed,
  2. int x,
  3. int y,
  4. double xd,
  5. double yd,
)

Implementation

double gradCoord2D(int seed, int x, int y, double xd, double yd) {
  int hash = seed;
  hash ^= X_PRIME * x;
  hash ^= Y_PRIME * y;
  hash = hash * hash * hash * 60493;
  hash = (hash >> 13) ^ hash;
  D2 g = GRAD_2D[hash & 7];
  return xd * g.x + yd * g.y;
}