package projectzombie.util.math.random;

import java.util.Random;

import gl_engine.MathHelpers;

public class NoiseGeneratorSimplex implements NoiseGenerator
{
	private OpenSimplexNoise simplex;
	private double off_x, off_y, off_z;
	
	public NoiseGeneratorSimplex(Random rand)
	{
		simplex = new OpenSimplexNoise(rand.nextLong());
		off_x = MathHelpers.map(rand.nextDouble(), 0, 1, -1024, 1024);
		off_y = MathHelpers.map(rand.nextDouble(), 0, 1, -1024, 1024);
		off_z = MathHelpers.map(rand.nextDouble(), 0, 1, -1024, 1024);
	}
	
	@Override
	public double eval(double x, double y) {
		return simplex.eval(x + off_x, y + off_y);
	}
	
	@Override
	public double eval(double x, double y, double z) {
		return simplex.eval(x + off_x, y + off_y, z + off_z);
	}
}
