public Plot3DMainForm(float[, ,] vals) { InitializeComponent(); this.comboBox1.SelectedIndex = 0; sr = new Surface3DRenderer(70, 35, 40, 0, 0, ClientRectangle.Width, ClientRectangle.Height, 0, 0, vals, this); sr.SetFunction("val"); sr.recalculateFunction(); minNum.Minimum = (decimal)sr.minZ; maxNum.Maximum = (decimal)sr.maxZ; maxNum.Minimum = (decimal)sr.minZ; minNum.Maximum = (decimal)sr.maxZ; minNum.Value = (decimal)sr.minZ; maxNum.Value = (decimal)sr.maxZ; Form1_Resize(null, null); ResizeRedraw = true; DoubleBuffered = true; this.vals = vals; trackBar2.Value = sr.Quality; xNum.Maximum = vals.GetLength(0); yNum.Maximum = vals.GetLength(1); zNum.Maximum = vals.GetLength(2); xNum.Value = 1; yNum.Value = 1; zNum.Value = 1; xNum.Minimum = 1; yNum.Minimum = 1; zNum.Minimum = 1; }
public Plot3DMainForm() { InitializeComponent(); sr = new Surface3DRenderer(70, 35, 40, 0, 0, ClientRectangle.Width, ClientRectangle.Height, 0.5, 0, 0); sr.ColorSchema = new ColorSchema(tbHue.Value); sr.SetFunction("sin(x1)*cos(x2)/(sqrt(sqrt(x1*x1+x2*x2))+1)*10"); Form1_Resize(null, null); ResizeRedraw = true; DoubleBuffered = true; }
public SurfaceGraphViewer() { InitializeComponent(); this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.SurfaceGraphMouseWheel); sr = new Surface3DRenderer(pov_x, pov_y, pov_z, pan_x, pan_y, ClientRectangle.Width, ClientRectangle.Height, pov_d, 0, 0); sr.ColorSchema = new ColorSchema(0); sr.Density = 1; ResizeRedraw = true; DoubleBuffered = true; }
/// <param name="obsX">Observator's X position</param> /// <param name="obsY">Observator's Y position</param> /// <param name="obsZ">Observator's Z position</param> /// <param name="xs0">X coordinate of screen</param> /// <param name="ys0">Y coordinate of screen</param> /// <param name="screenDistance">The screen distance.</param> /// <param name="screenWidthPhys">Width of the screen in meters.</param> /// <param name="screenHeightPhys">Height of the screen in meters.</param> public Plot3D(Func <double, double, double> function, double obsX = 70, double obsY = 35, double obsZ = 40, int xs0 = 0, int ys0 = 0, double screenDistance = 0.5, double screenWidthPhys = 0, double screenHeightPhys = 0) { this.obsX = obsX; this.obsY = obsY; this.obsZ = obsZ; this.xs0 = xs0; this.ys0 = ys0; this.screenDistance = screenDistance; this.screenWidthPhys = screenWidthPhys; this.screenHeightPhys = screenHeightPhys; this.sr = new Surface3DRenderer(obsX, obsY, obsZ, xs0, ys0, ClientRectangle.Width, ClientRectangle.Height, screenDistance, screenWidthPhys, screenHeightPhys); this.sr.Function = function; OnResize(null); ResizeRedraw = true; DoubleBuffered = true; }
public static void Draw3DSurface(PictureBox pBox) { //set up objects Bitmap bitmap = new Bitmap(width, height); Graphics graphics = Graphics.FromImage(bitmap); renderer3d = new Surface3DRenderer(observableXYZ.x, observableXYZ.y, observableXYZ.z, screenXY.X, screenXY.Y, width, height, zoom, 0, 0); renderer3d.MultiThreaded = MultiThreaded; //set mouse events pBox.Paint += Draw3DSurface_Paint; pBox.MouseWheel += Draw3DSurface_MouseWheel; pBox.MouseDown += Draw3DSurface_MouseDown; pBox.MouseUp += Draw3DSurface_MouseUp; pBox.MouseMove += Draw3DSurface_MouseMove; CapturingMouse_3DSurface = true; if (BlackAndWhite) renderer3d.ColorSchema = ColorSchema.Greyscale(); else renderer3d.ColorSchema = ColorSchema.Hsv; //render surface renderer3d.RenderSurface(graphics, pixelMatrix, AdjustmentValue); graphics.Dispose(); pBox.Image = bitmap; }