noise2 method

  1. @override
double noise2(
  1. double x,
  2. double y
)
override

Implementation

@override
double noise2(double x, double y) {
  int x0 = floor(x);
  int y0 = floor(y);
  int x1 = x0 + 1;
  int y1 = y0 + 1;
  double xs = 0, ys = 0, zs = 0;
  xs = x - x0;
  ys = y - y0;
  double xf00 = lerp(valCoord2D(seed, x0, y0), valCoord2D(seed, x1, y0), xs);
  double xf10 = lerp(valCoord2D(seed, x0, y1), valCoord2D(seed, x1, y1), xs);
  double xf01 = lerp(valCoord2D(seed, x0, y0), valCoord2D(seed, x1, y0), xs);
  double xf11 = lerp(valCoord2D(seed, x0, y1), valCoord2D(seed, x1, y1), xs);
  double yf0 = lerp(xf00, xf10, ys);
  double yf1 = lerp(xf01, xf11, ys);
  return lerp(yf0, yf1, zs);
}