public Surface_Irregular() { // This call is required by the Windows Form Designer. InitializeComponent(); /* * Arrays of X and Z values with sample points... * The values have floating point decimals and define * an irregular grid */ double [] xval = new double[10] { 0.1, 0.2, 0.3, 0.5, 0.8, 1.1, 1.5, 2.0, 2.2, 3.0 }; double [] zval = new double[10] { 0.5, 0.6, 0.7, 0.75, 0.8, 1.1, 1.5, 2.0, 2.2, 5.6 }; surfaceSeries1.IrregularGrid = true; // <---------- VERY IMPORTANT !!! surfaceSeries1.GetVertAxis.SetMinMax(-2.0, 2.0); // axis scale for Y values // Now add all "Y" points... // An irregular grid of 10 x 10 cells surfaceSeries1.NumXValues = 10; surfaceSeries1.NumZValues = 10; double y; for (int x = 0; x < 9; x++) // = 10 rows { for (int z = 0; z < 9; z++) // = 10 columns { y = Math.Sin(z * Math.PI / 10.0) * Math.Cos(x * Math.PI / 5.0); // example Y value surfaceSeries1.Add(xval[x], y, zval[z]); } } }
public Wall_Transparency() { // This call is required by the Windows Form Designer. InitializeComponent(); for (int x = -10; x <= 10; ++x) { for (int z = -10; z <= 10; ++z) { surface1.Add(x, Calc(x, z), z); } } }
private void AddSurfacePoints() { const int NumX = 50; const int NumZ = 30; for (int x = 0; x <= NumX; ++x) { for (int z = 0; z <= NumZ; ++z) { surface1.Add(x, Math.Cos(0.14 * x) * Math.Cos(0.25 * z) + 0.01 * (x - (NumX / 2)) * (z - (NumZ / 2)) + 13 * Math.Exp(-0.06 * (Math.Pow(x - (NumX / 2), 2) + Math.Pow(z - (NumZ / 2), 2))) + 6 * Math.Exp(-0.03 * (Math.Pow(x - (NumX / 3), 2) + Math.Pow(z - 3 * (NumZ / 5), 2))) - 1, z); } } }