Ejemplo n.º 1
0
        private void OnPenDraw()
        {
            // Clear if needed
            if (willClearFrames > 0)
            {
                willClearFrames--;
                if (willClearFrames == 0)
                {
                    pen.DrawRect(GetViewportRect(), clearColor);
                }
            }

            DrawFunction?.Invoke(pen);
        }
Ejemplo n.º 2
0
        public void DrawCurve(Graphics g, DrawFunc func, double x, double step = 0.1)
        {
            List <PointF> points = new List <PointF>();

            for (double i = -x; i < x; i += step)
            {
                var res = func.Invoke(i);
                if (!double.IsNaN(res) && !double.IsInfinity(res))
                {
                    points.Add(new PointF(II(i), JJ(res)));
                }
            }

            if (points.Count > 1)
            {
                g.DrawCurve(Pens.Black, points.ToArray());
            }
        }