Пример #1
0
        public void Draw(Conv1D c)
        {
            // if (!dodraw) return;
            //Draw2Xsection(); return;
            drawlist.Add(c);
            Form df  = this;
            int  mar = 5; // y margin

            df.Show();
            Graphics formGraphics = df.CreateGraphics();
            // formGraphics.Clear(Conv2DColor.Green);
            Pen myPen = new Pen(col);

            myPen.Width *= 1;

            float ymax = c.Max();      //  1.5f;   // c.Max()
            float ymin = -ymax * 0.5f; // c.Min()
            float rx   = df.ClientSize.Width / (2 * drawRange);
            float ry   = (df.ClientSize.Height - 2 * mar) / (ymax - ymin);
            float my   = ymax + mar / ry;
            float ov   = 0;

            for (float x = c.xlo; x <= c.xhi; x += c.xstep)
            {
                float v = c[x];
                formGraphics.DrawLine(myPen, (x - c.xstep + drawRange) * rx, (my - ov) * ry, (x + drawRange) * rx, (my - v) * ry);
                ov = v;
            }
            myPen.Dispose();
            formGraphics.Dispose();
            // Draw2Xsection();
        }