/// <summary> /// Calculate and set the weights of the particles based on a measurement. /// </summary> /// <param name="parCon">The particles to calculate and set the weights for</param> /// <param name="diffs">List containing the difference between the measurement and a particle value.</param> /// <param name="dist">The propability distribution of the measurement.</param> private void CalculateWeights(AbstractParticleController parCon, IList <float> diffs, IDistribution dist) { for (int index = 0; index < diffs.Count; index++) { float diff = diffs[index]; float p = (float)(dist.CDF(0, diff + Cdfmargin) - dist.CDF(0, diff - Cdfmargin)); parCon.SetWeightAt(index, parCon.GetWeightAt(index) * p); } }