Beispiel #1
0
        private void Setdata(Chart3D c3d, int fx, double density, double minX, double maxX, double minY, double maxY, Point3[,] sP, Point3[,] P)
        {
            //set the lower/upper bound with offset
            c3d.C3Axes.XMin = (float)minX - (float)(0.2 * (Function.upperP(this.fx) - Function.lowerP(this.fx)));
            c3d.C3Axes.XMax = (float)maxX + (float)(0.2 * (Function.upperP(this.fx) - Function.lowerP(this.fx)));
            c3d.C3Axes.YMin = (float)minY - (float)(0.2 * (Function.upperP(this.fx) - Function.lowerP(this.fx)));
            c3d.C3Axes.YMax = (float)maxY + (float)(0.2 * (Function.upperP(this.fx) - Function.lowerP(this.fx)));

            c3d.C3Axes.XTick = (float)(0.25 * (maxX - minX));
            c3d.C3Axes.YTick = (float)(0.25 * (maxY - minY));

            c3d.C3DataSeries.XDataMin = c3d.C3Axes.XMin;
            c3d.C3DataSeries.YDataMin = c3d.C3Axes.YMin;
            //set space between points for surface plotting
            c3d.C3DataSeries.XSpacing = (float)(density * (maxX - minX));
            c3d.C3DataSeries.YSpacing = (float)(density * (maxY - minY));
            c3d.C3DataSeries.XNumber  = Convert.ToInt16((c3d.C3Axes.XMax -
                                                         c3d.C3Axes.XMin) / c3d.C3DataSeries.XSpacing) + 1;
            c3d.C3DataSeries.YNumber = Convert.ToInt16((c3d.C3Axes.YMax -
                                                        c3d.C3Axes.YMin) / c3d.C3DataSeries.YSpacing) + 1;

            P = new Point3[c3d.C3DataSeries.XNumber,
                           c3d.C3DataSeries.YNumber];
            minf = +1e13;
            maxf = -1e13;
            //calculate necessary points for surface plotting
            for (int i = 0; i < c3d.C3DataSeries.XNumber; i++)
            {
                for (int j = 0; j < c3d.C3DataSeries.YNumber; j++)
                {
                    float x = c3d.C3DataSeries.XDataMin +
                              i * c3d.C3DataSeries.XSpacing;
                    float y = c3d.C3DataSeries.YDataMin +
                              j * c3d.C3DataSeries.YSpacing;
                    double   zz    = 0;
                    double[] point = { x, y };
                    zz = Function.Test_Function(fx, point);
                    if (minf > zz)
                    {
                        minf = zz;
                    }
                    if (maxf < zz)
                    {
                        maxf = zz;
                    }
                    float z = (float)zz;
                    P[i, j] = new Point3(x, y, z, 1);
                }
            }
            c3d.C3Axes.ZMin = (float)minf;
            c3d.C3Axes.ZMax = (float)maxf;

            c3d.C3Axes.ZTick = (float)(0.25 * (maxf - minf));
            c3d.C3DataSeriesSupport.PointArray = P;
            c3d.C3DataSeries.PointArray        = sP;
        }
Beispiel #2
0
 private void Draw3DFunction(Chart3D c3d, int mode, int fx, double density, double minX, double maxX, double minY, double maxY, Point3[,] sP, Point3[,] P)
 {
     c3d.C3DrawChart.CMap                 = cm.Jet();                          //select theme for surface plotting
     c3d.C3DrawChart.ChartType            = DrawChart.ChartTypeEnum.Scatter3D; //select chart type
     c3d.C3ChartStyle.IsColorBar          = true;
     c3d.C3Labels.Title                   = "";
     c3d.C3DataSeries.LineStyle.IsVisible = false;
     c3d.mode = mode; //select drawing mode
     Setdata(c3d, fx, density, minX, maxX, minY, maxY, sP, P);
 }
Beispiel #3
0
 public Form1()
 {
     InitializeComponent();
     chart = new Chart3D(sg);
 }