using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using o0.Geometry;
using o0.Num;

namespace o0.IMU
{
    public class HardwareVariance
    {
        public List<Vector<double>> Vector;
        public int MaxCount;
        public HardwareVariance(int MaxCount = 1000)
        {
            Vector = null;
            this.MaxCount = MaxCount;
        }
        public void Start()
        {
            Vector = new List<Vector<double>>();
        }
        public Vector<double> Update(Vector<double> Vector)
        {
            if (this.Vector == null)
                return default;
            this.Vector.Add(Vector);
            if(this.Vector.Count < MaxCount)
                return default;
            var variance = this.Vector.Variance();
            this.Vector = null;
            return variance;
        }
    }
}
