public MovingBitmap(Bitmap bitmap, PositionFunction positionFunction)
 {
     if (bitmap == null)
     {
         throw new ArgumentNullException("bitmap");
     }
     else if (positionFunction == null)
     {
         throw new ArgumentNullException("bitmap");
     }
     this.bitmap           = bitmap;
     this.positionFunction = positionFunction;
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a new agent with the specified position, velocity, radiation function and send message function.
        /// </summary>
        /// <param name="PX">Represents the X coordinate of the agent position.</param>
        /// <param name="PY">Represents the Y coordinate of the agent position.</param>
        /// <param name="VX">Represents the X coordinate of the agent velocity.</param>
        /// <param name="VY">Represents the Y coordinate of the agent velocity.</param>
        /// <param name="RadiationFunction">Represents the function used by the agent to calculate the radiation intensity as measured by a sensor at any given position.</param>
        /// <param name="SendMessage">// Represents the function used by the agent to send messages to other nearby agents.</param>
        public Agent(double PX, double PY, double VX, double VY, PositionFunction RadiationFunction, SendMessageFunction SendMessage)
        {
            this.PX = PX;
            this.PY = PY;

            this.VX = VX;
            this.VY = VY;

            this.MyBestX = PX;
            this.MyBestY = PY;

            this.RadiationFunction = RadiationFunction;

            // Evaluate the radiation intensity at te initial position as the best visited-by-the-agent position til now.
            this.MyBestValue = RadiationFunction(PX, PY);

            this.SendMessage = SendMessage;
        }