Beispiel #1
0
            private void ProcessEdge(GroundEdge edge)
            {
                IEnumerable <PotentialDiagonal> potentialDiagonals = grid.GetPotentialDiagonals(edge);

                foreach (PotentialDiagonal potentialDiagonal in potentialDiagonals)
                {
                    if (!unavailableDiagonals.Contains(potentialDiagonal.Key))
                    {
                        if (availableDiagonals.ContainsKey(potentialDiagonal.Key))
                        {
                            PotentialDiagonal otherHalf = availableDiagonals[potentialDiagonal.Key];
                            if (potentialDiagonal.SharedPoint != otherHalf.SharedPoint)
                            {
                                GroundQuad newQuad = new GroundQuad(potentialDiagonal.EdgeA, potentialDiagonal.EdgeB, otherHalf.EdgeA, otherHalf.EdgeB);
                                RegisterNewQuad(newQuad);
                                quads.Add(newQuad);
                            }
                        }
                        else
                        {
                            availableDiagonals.Add(potentialDiagonal.Key, potentialDiagonal);
                        }
                    }
                }
            }
Beispiel #2
0
 private void RegisterNewQuad(GroundQuad newQuad)
 {
     foreach (string key in GetKeysFor(newQuad))
     {
         if (availableDiagonals.ContainsKey(key))
         {
             availableDiagonals.Remove(key);
         }
         unavailableDiagonals.Add(key);
     }
 }
Beispiel #3
0
            private IEnumerable <string> GetKeysFor(GroundQuad quad)
            {
                yield return(PotentialDiagonal.GetKey(quad.Points[0].Index, quad.Points[2].Index));

                yield return(PotentialDiagonal.GetKey(quad.Points[1].Index, quad.Points[3].Index));
            }