private void MainForm_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (points == null) { points = new List<DelaunauTriangulationSample.Classes.Point>(); g.Clear(Color.White); } DelaunauTriangulationSample.Classes.Point mbToAdd = new DelaunauTriangulationSample.Classes.Point(e.X, Size.Height - e.Y); if (!points.Contains(mbToAdd)) points.Add(mbToAdd); g.DrawEllipse(new Pen(Color.Red), e.X - 1, e.Y - 1, 3, 3); } else { if (points == null) { g.Clear(Color.White); Random rnd = new Random(); points = new List<DelaunauTriangulationSample.Classes.Point>(); for (int i = 0; i < Count.Value; i++) { DelaunauTriangulationSample.Classes.Point tmp = new DelaunauTriangulationSample.Classes.Point(rnd.Next(Size.Width - 200) + 30, rnd.Next(Size.Height - 100) + 50); if (!points.Contains(tmp)) points.Add(tmp); g.DrawEllipse(defaultPointPen, (int)tmp.X - 1, Size.Height - (int)tmp.Y + 1, 3, 3); } } Triangulation tb = new Triangulation(points, g, defaultLinePen, defaultPointPen, defaultNewLintPen, Size.Height, Delay.Value); points = null; } }
private void MainForm_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (points == null) { points = new List <DelaunauTriangulationSample.Classes.Point>(); g.Clear(Color.White); } DelaunauTriangulationSample.Classes.Point mbToAdd = new DelaunauTriangulationSample.Classes.Point(e.X, Size.Height - e.Y); if (!points.Contains(mbToAdd)) { points.Add(mbToAdd); } g.DrawEllipse(new Pen(Color.Red), e.X - 1, e.Y - 1, 3, 3); } else { if (points == null) { g.Clear(Color.White); Random rnd = new Random(); points = new List <DelaunauTriangulationSample.Classes.Point>(); for (int i = 0; i < Count.Value; i++) { DelaunauTriangulationSample.Classes.Point tmp = new DelaunauTriangulationSample.Classes.Point(rnd.Next(Size.Width - 200) + 30, rnd.Next(Size.Height - 100) + 50); if (!points.Contains(tmp)) { points.Add(tmp); } g.DrawEllipse(defaultPointPen, (int)tmp.X - 1, Size.Height - (int)tmp.Y + 1, 3, 3); } } Triangulation tb = new Triangulation(points, g, defaultLinePen, defaultPointPen, defaultNewLintPen, Size.Height, Delay.Value); points = null; } }