Exemple #1
0
 void Leagalize()
 {
     while (stack.Count > 0)
     {
         var s = stack.Pop();
         if (FindNodes(s, out DN n1, out DN n2))
         {
             var p1 = n1.triangle.RemainingPoint(s);
             var p2 = n2.triangle.RemainingPoint(s);
             if (n1.triangle.GetCircumscribledCircle().Contains(p2))
             {
                 var o = DN.Flip(n1, n2, s, p1, p2);
                 stack.Push(o.s1);
                 stack.Push(o.s2);
                 stack.Push(o.s3);
                 stack.Push(o.s4);
                 nodes.Remove(n1);
                 nodes.Remove(n2);
                 nodes.Add(o.n1);
                 nodes.Add(o.n2);
             }
         }
     }
 }