///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void PlaneParamsFormOnPlaneParamsChoosed(Pi_Class1.Plane somePlane) { subPlane(somePlane); }
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private void subPlane(Pi_Class1.Plane somePlane) { Image targetImage = pictureBox9.Image; List<Point3D> pointsList = new List<Point3D>(); for (int i = 0; i < targetImage.Width; i++) { for (int j = 0; j < targetImage.Height; j++) { Color currentColor = ((Bitmap)(targetImage)).GetPixel(i, j); int currentIntencity = currentColor.R; Point3D newPoint = new Point3D(i, j, currentIntencity); if (newPoint.z != 0) { pointsList.Add(newPoint); } } } OpenGLForm newForm = new OpenGLForm(); foreach (Point3D currentPoint in pointsList) { double planeZ = (somePlane.a * currentPoint.x) + (somePlane.b * currentPoint.y) + somePlane.c; //newForm.addPoint(new Point3D(currentPoint.x, currentPoint.y, (int)(currentPoint.z - planeZ), Color.RoyalBlue)); newForm.addPoint(new Point3D(currentPoint.x, currentPoint.y, (int)planeZ, Color.Red)); newForm.addPoint(new Point3D(currentPoint.x, currentPoint.y, currentPoint.z, Color.Green)); Color planeColor; if ((int)(currentPoint.z - planeZ) > 255) { planeColor = Color.White; } else if ((int)(currentPoint.z - planeZ) < 0) { planeColor = Color.Black; } else { planeColor = Color.FromArgb((int)(currentPoint.z - planeZ), (int)(currentPoint.z - planeZ), (int)(currentPoint.z - planeZ)); } ((Bitmap)(mainPictureBox.Image)).SetPixel(currentPoint.x, currentPoint.y, planeColor); } mainPictureBox.Invalidate(); newForm.Show(); PlaneParamsForm planeParamsForm = new PlaneParamsForm(somePlane); planeParamsForm.planeParamsChoosed+=PlaneParamsFormOnPlaneParamsChoosed; planeParamsForm.Show(); }