示例#1
0
  public AltNoise(long seed, double scalex, double scaley, double scalez) {
    this.scalex = 1.0 / scalex;
    this.scaley = 1.0 / scaley;
    this.scalez = 1.0 / scalez;

    this.seed = seed;
    this.rand = new Random(seed);

    this.samples = new Vector3[256];
    for (int i = 0; i < this.samples.length; i++) {
      this.samples[i] = Vector3.randomUnitVector(this.rand);
    }
  }
示例#2
0
  private double gradNoise(double fx, double fy, double fz, int ix, int iy, int iz) {
    Vector3 grad = this.grad(ix, iy, iz);
    Vector3 point = new Vector3(fx - ix, fy - iy, fz - iz);

    return grad.dot(point) * 2.12;
  }