import WBVector3 from '../util/wbVector3';
import { mulberryPRNG } from '../util/random';
import { createNoise3D } from '../util/simplexNoise';
export default class NoiseMap3D {
    constructor(seed, scale, thresholds) {
        this.seed = seed;
        this.scale = scale;
        this.noiseFunc = createNoise3D(mulberryPRNG(seed));
        if (typeof thresholds === 'number')
            this.thresholds = [thresholds];
        else
            this.thresholds = [...thresholds];
    }
    query(location, threshold = 0) {
        const t = this.thresholds[threshold];
        const scaled = WBVector3.fromMC(location).multiply(1 / this.scale);
        const v = this.noiseFunc(...scaled.toTuple());
        return v > t;
    }
}
