Пример #1
0
        public void calcPoints()
        {
            this.points = new List <PointF>();

            for (float i = -100; i <= 100; i = i + this._resolution)
            {
                FlippedPointF newPoint = new FlippedPointF(0, 0);
                newPoint.X = i;
                newPoint.Y = this.y(i);

                if (Single.IsNaN(newPoint.Y) || Single.IsInfinity(newPoint.Y))
                {
                    continue;
                }

                this.points.Add(newPoint.toPoint());
            }
        }
Пример #2
0
        public void Draw(Graphics g)
        {
            g.DrawLines(pen, points.ToArray());
            if (showAreaBelow)
            {
                foreach (PointF p in points)
                {
                    g.DrawLine(areaPen, p, new PointF(p.X, 0));
                }
            }
            if (showApproximationRects)
            {
                for (float i = 0; i <= 100; i = i + this.widthApproximationRects)
                {
                    FlippedPointF newPoint = new FlippedPointF(0, 0);
                    newPoint.X = i;
                    newPoint.Y = this.y(i);

                    if (Single.IsNaN(newPoint.Y) || Single.IsInfinity(newPoint.Y))
                    {
                        continue;
                    }

                    g.DrawRectangle(this.areaPen, newPoint.toPoint().X, newPoint.toPoint().Y, this.widthApproximationRects, this.y(i));
                }
                for (float i = 0; i > -100; i = i - this.widthApproximationRects)
                {
                    FlippedPointF newPoint = new FlippedPointF(0, 0);
                    newPoint.X = i;
                    newPoint.Y = this.y(i);

                    if (Single.IsNaN(newPoint.Y) || Single.IsInfinity(newPoint.Y))
                    {
                        continue;
                    }

                    g.DrawRectangle(this.areaPen, newPoint.toPoint().X - this.widthApproximationRects, newPoint.toPoint().Y, this.widthApproximationRects, this.y(i));
                }
            }
        }