Exemplo n.º 1
0
 private bool CanUnify()
 {
     if (_children != null && _children.Any(c => c != null && c.Active))
     {
         for (int i = 0; i < 4; i++)
         {
             EdgeType edge     = (EdgeType)i;
             Quad     neighbor = GetNeighbor(edge);
             if (neighbor != null)
             {
                 if (!neighbor.Active && neighbor.HasChildren)
                 {
                     EdgeType neighborEdge = neighbor.GetEdgeSharedWith(this);
                     var      children     = neighbor.GetChildrenSharingEdge(neighborEdge);
                     if (children.Any(c => c != null && !c.Active && c.HasChildren))
                     {
                         return(false); // unable to Unify due to neighbor subdivision
                     }
                 }
             }
         }
     }
     return(true);
 }