SuperImageEvolver.SoftTranslateMutator.MoveShape C# (CSharp) Méthode

MoveShape() static private méthode

static private MoveShape ( Random rand, Shape shape, TaskState task ) : void
rand System.Random
shape Shape
task TaskState
Résultat void
        static void MoveShape( Random rand, Shape shape, TaskState task )
        {
            RectangleF rect = shape.GetBoundaries();
            int maxOverlap = task.ProjectOptions.MaxOverlap;
            PointF delta = new PointF {
                X =
                    rand.NextFloat( Math.Max( -maxOverlap, -rect.X - maxOverlap ),
                                    Math.Min( maxOverlap, task.ImageWidth - rect.Right + maxOverlap ) ),
                Y =
                    rand.NextFloat( Math.Max( -maxOverlap, -rect.Y - maxOverlap ),
                                    Math.Min( maxOverlap, task.ImageHeight - rect.Bottom + maxOverlap ) )
            };
            for( int i = 0; i < shape.Points.Length; i++ ) {
                shape.Points[i].X += delta.X;
                shape.Points[i].Y += delta.Y;
            }
        }