예제 #1
0
        private void button1_Click(object sender, EventArgs e)      // кнпка cancel
        {
            if (points.Count > 0)
            {
                Point2D p = points.Last();
                points.Remove(p);
                if (points.Count == 2)
                {
                    selectedTriangle = null;
                    if (triangulated != null)
                    {
                        triangulated.Clear();
                    }
                }
                else
                {
                    if (points.Count > 2)
                    {
                        selectedTriangle = null;
                        delaunay         = new DelaunayTriangulation(points);
                        triangulated     = delaunay.Triangulate();

                        triangulatedWithCircles = delaunay.GetCircles(triangulated);
                        Refresh();
                    }
                }
            }
            Refresh();
        }
예제 #2
0
 private void button2_Click(object sender, EventArgs e)//triangular
 {
     if (points.Count > 2)
     {
         selectedTriangule = null;
         delaunay          = new DelaunayTriangulation(points);
         triangulated      = delaunay.Triangulate();
         if (checkBox1.Checked)
         {
             triangulatedWithCircles = delaunay.GetCircumcicles(triangulated);
         }
         Refresh();
     }
 }
예제 #3
0
 private void Form1_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.Control && e.KeyCode == Keys.Z)
     {
         if (points.Count > 0)
         {
             points.RemoveAt(points.Count - 1);
             delaunay     = new DelaunayTriangulation(points);
             triangulated = delaunay.Triangulate();
             if (checkBox1.Checked)
             {
                 triangulatedWithCircles = delaunay.GetCircumcicles(triangulated);
             }
             Refresh();
         }
     }
 }
예제 #4
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                released = true;
                if (points.Count > 2)
                {
                    selectedTriangle = null;
                    delaunay         = new DelaunayTriangulation(points);
                    triangulated     = delaunay.Triangulate();

                    triangulatedWithCircles = delaunay.GetCircles(triangulated);
                    Refresh();
                }
                Refresh();
            }
        }