예제 #1
0
        //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();
            }
        }
예제 #2
0
        //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);
        }
예제 #3
0
        //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();
        }