Normalize() public method

public Normalize ( ) : void
return void
Example #1
0
        /// <summary>
        ///  applys a force to the ball in the direction of heading. Truncates
        ///  the new velocity to make sure it doesn't exceed the max allowable.
        ///
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="force"></param>
        public void Kick(Vector2D direction, double force)
        {
            //ensure direction is normalized
            direction.Normalize();

            //calculate the acceleration
            Vector2D acceleration = (direction * force) / Mass;

            //update the velocity
            Velocity = acceleration;
        }
Example #2
0
        /// <summary>
        ///  applys a force to the ball in the direction of heading. Truncates
        ///  the new velocity to make sure it doesn't exceed the max allowable.
        /// 
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="force"></param>
        public void Kick(Vector2D direction, double force)
        {
            //ensure direction is normalized
            direction.Normalize();

            //calculate the acceleration
            Vector2D acceleration = (direction * force) / Mass;

            //update the velocity
            Velocity = acceleration;
        }