示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PositionParticleFilter"/> class.
 /// </summary>
 /// <param name="noiseGenerator">See noiseGenerator argument of the constructor of <seealso cref="AbstractParticleFilter"/></param>
 /// <param name="resampleNoiseSize">See resampleNoiseSize argument of the constructor of <seealso cref="AbstractParticleFilter"/></param>
 /// <param name="resampler">See resampler argument of the constructor of <seealso cref="AbstractParticleFilter"/></param>
 /// <param name="particleGenerator">See particleGenerator argument of the constructor of <seealso cref="AbstractParticleFilter"/></param>
 /// <param name="particleAmount">See particleAmount argument of the constructor of <seealso cref="AbstractParticleFilter"/></param>
 /// <param name="fieldSize">The dimensions of the area where the user can be.</param>
 /// <param name="smoother">See smoother argument of the constructor of <seealso cref="AbstractParticleFilter"/></param>
 public PositionParticleFilter(
     INoiseGenerator noiseGenerator,
     float resampleNoiseSize,
     IResampler resampler,
     IParticleGenerator particleGenerator,
     int particleAmount,
     FieldSize fieldSize,
     ISmoother smoother)
     : base(
         resampler,
         noiseGenerator,
         new LinearParticleController(particleGenerator, particleAmount, fieldSize.Xmin, fieldSize.Xmax),
         new LinearParticleController(particleGenerator, particleAmount, fieldSize.Ymin, fieldSize.Ymax),
         new LinearParticleController(particleGenerator, particleAmount, fieldSize.Zmin, fieldSize.Zmax),
         resampleNoiseSize,
         smoother,
         Enumerable.Average)
 {
     this.displacementSources = new List <IDisplacementSource>();
     this.positionSources     = new List <IPositionSource>();
     this.iex = new LinearRegression();
     this.iey = new LinearRegression();
     this.iez = new LinearRegression();
 }
示例#2
0
        /// <summary>
        /// Predicts the value for the current timestamp and move the particles.
        /// </summary>
        /// <param name="cont">The dimension to predict in.</param>
        /// <param name="ie">The prediction algorithm to use.</param>
        private void Predict(AbstractParticleController cont, IExtrapolate ie)
        {
            float prediction = (float)ie.PredictChange(this.PreviousTimeStamp, this.CurrentTimeStamp);

            cont.AddToValues(prediction);
        }