コード例 #1
0
 void UpdateGraphs()
 {
     plotter.Curves.Clear();
     for (int i = 0; i < graphs.Count; i++)
     {
         if (graphs[i].Shown)
         {
             graphs[i].Curve.Points.Clear();
             plotter.Curves.Add(graphs[i].Curve);
             float resolution = graphs[i].Resolution > 0 ? graphs[i].Resolution : plotter.XResolution;
             for (float x = 0; x >= plotter.GetMinX(); x -= resolution)
             {
                 PointF point = new PointF(x, (float)graphs[i].Expression.CalculateValue(new double[] { x }));
                 graphs[i].Curve.Points.Add(point);
             }
             graphs[i].Curve.Points.Reverse();
             for (float x = resolution; x <= plotter.GetMaxX(picBox_graph.Width); x += resolution)
             {
                 graphs[i].Curve.Points.Add(new PointF(x, (float)graphs[i].Expression.CalculateValue(new double[] { x })));
             }
         }
     }
 }