package genesom;

// zwei Betriebsmodi:
// (a) gebe from, to           Gaussglocke von f(from) = 0  bis to f(span) = to
// (b) gebe from, to und eta   from an 0 mit f(span/2) = eta * (from - to) + to
// ist eta <= 0., dann (a)
// sonst to = from * (eta + (1-eta) * to / from)^4

public class GaussDecayModel
  extends DecayModel
{

  protected double f;

  public boolean init() {

    if(to <= 0. || from <= 0. || to > from) return true;

    if(eta <= 0.) { f = 1.; eta = 0.; } else f = 4.;

    f *= Math.log((eta * (from - to) + to) / from) / (span * span);

    to = calcResult(span);

    return super.init();
  }

  public double calcResult(double distance) {
    return from * Math.exp(distance * distance * f);
  }
}

