public static void Sinc3D(Chart3DControl.ChartStyle cs, Chart3DControl.DataSeriesSurface ds) { cs.Xmin = -8; cs.Xmax = 8; cs.Ymin = -8; cs.Ymax = 8; cs.Zmin = -0.5f; cs.Zmax = 1; cs.XTick = 4; cs.YTick = 4; cs.ZTick = 0.5f; ds.XLimitMin = cs.Xmin; ds.YLimitMin = cs.Ymin; ds.XSpacing = 0.5; ds.YSpacing = 0.5; ds.XNumber = Convert.ToInt16((cs.Xmax - cs.Xmin) / ds.XSpacing) + 1; ds.YNumber = Convert.ToInt16((cs.Ymax - cs.Ymin) / ds.YSpacing) + 1; Point3D[,] pts = new Point3D[ds.XNumber, ds.YNumber]; for (int i = 0; i < ds.XNumber; i++) { for (int j = 0; j < ds.YNumber; j++) { double x = ds.XLimitMin + i * ds.XSpacing; double y = ds.YLimitMin + j * ds.YSpacing; double r = Math.Sqrt(x * x + y * y) + 0.000001; double z = Math.Sin(r) / r; pts[i, j] = new Point3D(x, y, z); } } ds.PointArray = pts; }
public static void Peak3D(Chart3DControl.ChartStyle cs, Chart3DControl.DataSeriesSurface ds) { cs.Xmin = -3; cs.Xmax = 3; cs.Ymin = -3; cs.Ymax = 3; cs.Zmin = -16; cs.Zmax = 8; cs.XTick = 1; cs.YTick = 1; cs.ZTick = 4; ds.XLimitMin = cs.Xmin; ds.YLimitMin = cs.Ymin; ds.XSpacing = 0.2; ds.YSpacing = 0.2; ds.XNumber = Convert.ToInt16((cs.Xmax - cs.Xmin) / ds.XSpacing) + 1; ds.YNumber = Convert.ToInt16((cs.Ymax - cs.Ymin) / ds.YSpacing) + 1; Point3D[,] pts = new Point3D[ds.XNumber, ds.YNumber]; for (int i = 0; i < ds.XNumber; i++) { for (int j = 0; j < ds.YNumber; j++) { double x = ds.XLimitMin + i * ds.XSpacing; double y = ds.YLimitMin + j * ds.YSpacing; double z = 3 * Math.Pow((1 - x), 2) * Math.Exp(-x * x - (y + 1) * (y + 1)) - 10 * (0.2 * x - Math.Pow(x, 3) - Math.Pow(y, 5)) * Math.Exp(-x * x - y * y) - 1 / 3 * Math.Exp(-(x + 1) * (x + 1) - y * y); pts[i, j] = new Point3D(x, y, z); } } ds.PointArray = pts; }