/**
 * Mix Ripple layers
 * @param {LayerRipple} mother The mother layer
 * @param {LayerRipple} father The father layer
 * @constructor
 */
const MixerLayerRipple = function(mother, father) {
    this.mother = mother;
    this.father = father;
};

MixerLayerRipple.prototype = Object.create(Mixer.prototype);
MixerLayerRipple.prototype.SAMPLER_PLANE = new SamplerSigmoid(0, 1, 15);
MixerLayerRipple.prototype.SAMPLER_SCALE = new SamplerSigmoid(0, 1, 5);
MixerLayerRipple.prototype.SAMPLER_THRESHOLD = new SamplerSigmoid(0, 1, 3);
MixerLayerRipple.prototype.SAMPLER_THICKNESS = new SamplerSigmoid(0, 1, 6);

/**
 * Create a new layer that mixes the properties from both parents
 * @param {Random} random A randomizer
 * @returns {LayerRipple} The mixed layer
 */
MixerLayerRipple.prototype.mix = function(random) {
    const interpolateSample = random.getFloat();

    return new LayerRipple(
        this.mother.plane.interpolate(this.father.plane, this.SAMPLER_PLANE.sample(interpolateSample)),
        this.mother.paletteIndex,
        this.mixUint8(this.mother.scale, this.father.scale, this.SAMPLER_SCALE, interpolateSample),
        this.mixUint8(this.mother.thickness, this.father.thickness, this.SAMPLER_THICKNESS, interpolateSample),
        this.mixUint8(this.mother.threshold, this.father.threshold, this.SAMPLER_THRESHOLD, interpolateSample));
};