void initData() { int nx = npoints; int ny = npoints; float x0 = -5; float y0 = -5; float dx = 10.0f / (npoints - 1); float dy = 10.0f / (npoints - 1); sdata = (double[, ])Array.CreateInstance(typeof(double), nx, ny); wdata = (double[, ])Array.CreateInstance(typeof(double), nx, ny); rdata = (double[, ])Array.CreateInstance(typeof(double), nx, ny); for (int i = 0; i < nx; i++) { for (int j = 0; j < ny; j++) { float x = x0 + dx * i; float y = y0 + dy * j; sdata[i, j] = Math.Sqrt(50 - x * x - y * y); wdata[i, j] = (Math.Sin(x) + Math.Cos(y)); rdata[i, j] = rnd.NextDouble(); } } sphere_set = new C1.Win.C1Chart3D.Chart3DDataSetGrid(x0, y0, 1, 1, sdata); wave_set = new C1.Win.C1Chart3D.Chart3DDataSetGrid(x0, y0, 1, 1, wdata); }
private void build3D_Click(object sender, EventArgs e) { sdata = (double[, ])Array.CreateInstance(typeof(double), 60, 90); for (int i = 0; i < 60; i++) { for (int j = 0; j < 90; j++) { if ((i / 10.0 - 3) - (j / 10.0 - 2) < -3) { sdata[i, j] = 0; continue; } sdata[i, j] = 1 * (2 * 1 * (Math.Pow(((j / 10.0 - 2) - (i / 10.0 - 3)), 2) + Math.Pow((1 * 1 - (i / 10.0 - 3)), 2))) * 100; } } sphere_set = new C1.Win.C1Chart3D.Chart3DDataSetGrid(-3, -2, 0.1, 0.1, sdata); c1Chart3D1.ChartGroups[0].ChartData.SetGrid = sphere_set; }