Britbot
static Direction Britbot.Navigator.CalculateDirectionToStationeryTarget ( Location  myLoc,
HeadingVector  myHeading,
Location  target 
) [inline, static]

Given your location, you current direction and the target's location, this method calculates the best direction for you to move in order to simulate a straight line of motion to to your target.

Parameters:
myLocLocation of the one calling for direction
myHeadingcurrent direction
targetTargets location
Returns:
optimal direction

Definition at line 35 of file Navigator.cs.

        {
/*

            //get the desired direction
            HeadingVector desiredVector = HeadingVector.CalcDifference(myLoc, target);

            //variable for the best direction so far
            Direction bestDirection = Direction.NOTHING;
            double directionFitCoeff = -1;

            //going over all directions
            foreach (Direction dir in Bot.Game.GetDirections(myLoc, target))
            {
                //calculate new heading vector if we choose this direction
                HeadingVector newHeading = HeadingVector.adjustHeading(myHeading, dir);
                //calculate the dot product with the desired direction and normalize, if it is close to 1 it 
                //means that we are almost in the right direction
                double newFitCoef = newHeading.Normalize() * desiredVector.Normalize();
                
                //check if this direction is better (coefficient is larger) then the others
                if (newFitCoef > directionFitCoeff)
                {
                    //replace best
                    bestDirection = dir;
                    directionFitCoeff = newFitCoef;
                }
            }

            //return best direction found
            return bestDirection;*/
            Logger.BeginTime("CalculateDirectionToStationeryTarget");
            Direction d;
            //first check if we are already at the target
            if (myLoc.Equals(target))
                d = Direction.NOTHING;
            else
            //otherwise use the A* thing

                d = Navigator.CalculatePath(myLoc, target);
            Logger.StopTime("CalculateDirectionToStationeryTarget");
            return d;
        }