예제 #1
0
 public Envelope(SignalSamples original, SignalSamples extremas, bool upper)
 {
     AddParent(original);
     AddParent(extremas);
     _original = original;
     _extremas = extremas;
     _sign     = upper ? 1 : -1;
 }
예제 #2
0
 private void InitSignals()
 {
     _signalMouse         = new SignalSamples();
     _signalMouseD        = new Derivative(_signalMouse, scale: 0.1);
     _signalMouseDD       = new Derivative(_signalMouseD, scale: 0.1);
     _signalMouseI        = new Integrate(_signalMouse, scale: 1.0);
     _signalMouseExtrem   = new Extremas(_signalMouse);
     _signalMouseEnvUpper = new Envelope(_signalMouse, _signalMouseExtrem, true);
     _signalMouseEnvLower = new Envelope(_signalMouse, _signalMouseExtrem, false);
 }
예제 #3
0
        public void DrawSignal(Image image, double currentTime, double timeSpan, SignalSamples signal, Color color, double scaleY = 1.0)
        {
            int segmentLimit = 200; //!!! configure
            var poses        = new List <Point>();

            for (int i = 1; i <= segmentLimit; ++i)
            {
                var s = signal.GetSample(-i);
                if (!s.IsValid())
                {
                    break;               // no more samples
                }
                double t   = s.time - currentTime;
                Point  pos = new Point((float)t, (float)(s.value * scaleY));
                poses.Insert(0, pos);
                if (t < -timeSpan)
                {
                    break;                // gone out of view
                }
            }
            DrawSignal(image, poses.ToArray(), color);
        }
예제 #4
0
 public Integrate(SignalSamples original, double scale = 1.0)
 {
     AddParent(original);
     _original = original;
     _scale    = scale;
 }
예제 #5
0
 public Extremas(SignalSamples original)
 {
     AddParent(original);
     _original = original;
 }
예제 #6
0
 public Derivative(SignalSamples original, double scale = 1.0)
 {
     AddParent(original);
     _original = original;
     _scale    = scale;
 }