コード例 #1
0
 private EvoShape(List <EvoPoint> points, EvoColor color, int minPoints, int maxPoints)
 {
     shapePoints = new List <EvoPoint>();
     foreach (var point in points)
     {
         shapePoints.Add(point.Clone());
     }
     Color     = color.Clone();
     MinPoints = minPoints;
     MaxPoints = maxPoints;
 }
コード例 #2
0
        //Constructor creating a shape in memory
        public EvoShape(int minPoints, int maxPoints)
        {
            MinPoints = minPoints;
            MaxPoints = maxPoints;

            color = new EvoColor();

            shapePoints = new List <EvoPoint>();
            var center = new EvoPoint();

            for (int i = 0; i < MinPoints; i++)
            {
                int X = Math.Min(Math.Max(0, center.X + Numbers.GetRandom(-3, 3)), Numbers.MaxWidth);
                int Y = Math.Min(Math.Max(0, center.Y + Numbers.GetRandom(-3, 3)), Numbers.MaxHeight);
                shapePoints.Add(new EvoPoint(X, Y));
            }
        }