//add polygon to drawing public void addPol() { if (Polygons.Count < PolygonsMax) { var newPolygon = new MyDnaPolygon(); newPolygon.init(); int index = getRandomNumber(0, Polygons.Count); Polygons.Insert(index, newPolygon); setDefect(); } }
//clonning of polygons public MyDnaPolygon reproduction() { var newPolygon = new MyDnaPolygon(); newPolygon.Points = new List <MyDnaPoint>(); newPolygon.Brush = Brush.reproduction(); foreach (MyDnaPoint point in Points) { newPolygon.Points.Add(point.reproduction()); } return(newPolygon); }
//insert polygon public void putPol() { if (Polygons.Count < 1) { return; } int index = getRandomNumber(0, Polygons.Count); MyDnaPolygon poly = Polygons[index]; Polygons.RemoveAt(index); index = getRandomNumber(0, Polygons.Count); Polygons.Insert(index, poly); setDefect(); }