Пример #1
0
 //drawing Delaunay triangulation
 private void button2_Click(object sender, EventArgs e)
 {
     triangleList = Delaunay_Service.BowyerWatsonAlgorithm(pointList);
     Draw_Service.drawTriangle(bitmap, graphics, pictureBox1, triangleList);
     //Laplace smoothing
     if (checkBox1.Checked)
     {
         System.Threading.Thread.Sleep(3000);
         //remove vertices of supertriangle from list
         pointList.RemoveAt(pointList.Count - 1);
         pointList.RemoveAt(pointList.Count - 1);
         pointList.RemoveAt(pointList.Count - 1);
         List <PointF>   laplacePoints   = new List <PointF>();
         List <Triangle> smoothTriangles = new List <Triangle>();
         laplacePoints   = Laplace_Service.Laplace(triangleList, pointList);
         smoothTriangles = Delaunay_Service.BowyerWatsonAlgorithm(laplacePoints);
         Bitmap bitmap2 = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
         graphics = Graphics.FromImage(bitmap2);
         Draw_Service.drawPoints(bitmap2, graphics, pictureBox1, laplacePoints);
         Draw_Service.drawTriangle(bitmap2, graphics, pictureBox1, smoothTriangles);
     }
 }
Пример #2
0
 //drawing Voronoi diagram
 private void button3_Click(object sender, EventArgs e)
 {
     triangleList   = Delaunay_Service.BowyerWatsonAlgorithm(pointList);
     triangleList   = Delaunay_Service.BowyerWatsonAlgorithm(pointList);
     VoronoiDiagram = Voronoi_Service.DelaunayToVoronoi(triangleList);
     Draw_Service.drawDiagram(bitmap, graphics, pictureBox1, VoronoiDiagram);
     //Laplace smoothing
     if (checkBox1.Checked)
     {
         System.Threading.Thread.Sleep(3000);
         List <PointF>   laplacePoints   = new List <PointF>();
         List <Triangle> smoothTriangles = new List <Triangle>();
         laplacePoints   = Laplace_Service.Laplace(triangleList, pointList);
         smoothTriangles = Delaunay_Service.BowyerWatsonAlgorithm(laplacePoints);
         Bitmap bitmap2 = new Bitmap(pictureBox1.Size.Width, pictureBox1.Size.Height);
         graphics = Graphics.FromImage(bitmap2);
         List <Edge> laplaceEdges = new List <Edge>();
         laplaceEdges = Voronoi_Service.DelaunayToVoronoi(smoothTriangles);
         Draw_Service.drawPoints(bitmap2, graphics, pictureBox1, laplacePoints);
         Draw_Service.drawDiagram(bitmap2, graphics, pictureBox1, laplaceEdges);
     }
 }
Пример #3
0
 //drawing random points on picturebox - number of points enter by user
 private void button1_Click(object sender, EventArgs e)
 {
     pointList = Draw_Service.drawRandomPoints(bitmap, graphics, pictureBox1, Int32.Parse(textBox1.Text), pictureBox1.Size.Width, pictureBox1.Size.Height);
 }