Britbot
static bool Britbot.Group.CheckIfGroupsIntersects ( Group  g1,
Group  g2 
) [inline, static]

checks if two groups are messed around in one another TODO: make this smarter

Parameters:
g1first group
g2second group
Returns:
true if they are close enouth

Definition at line 954 of file Group.cs.

        {
            //first check direction stuff
            HeadingVector diff = HeadingVector.CalcDifference(g1.FindCenter(true), g2.FindCenter(true));

            //if they are not in the same direction or something
            if ((diff * g1.Heading < 0) || (g2.Heading * g1.Heading > 0))
            {
                if((g1.IsFormed()) && (g2.IsFormed()))
                    return false;
            }

            //going over all the pirates in G1
            foreach (int intPirate1 in g1.Pirates)
            {
                //convertion
                Pirate pirate1 = Bot.Game.GetMyPirate(intPirate1);

                //going over pirates in G2
                foreach (int intPirate2 in g2.Pirates)
                {
                    //conversion
                    Pirate pirate2 = Bot.Game.GetMyPirate(intPirate2);

                    //check if distance is small enough
                    if (Bot.Game.EuclidianDistanceSquared(pirate1.Loc, pirate2.Loc) <= Magic.GroupIntersectionDistance)
                        return true;
                }
            }

            //otherwise return false
            return false;
        }