diff --git a/Painter.cs b/Painter.cs index ed3c650..34dec22 100644 --- a/Painter.cs +++ b/Painter.cs @@ -308,7 +308,7 @@ void FindCoincidences(int face1, int face2) { var links = _faceLinks[i]; sum += links.Count; - for (int j = 0; j < links.Count; j++) + for (int j = links.Count-1; j >= 0; j--) { var backlink = _faceLinks[links[j].with].Find(x => x.with == i); if (backlink != null) @@ -316,7 +316,8 @@ void FindCoincidences(int face1, int face2) backlink.backLinkIdx = j; } else { - Debug.LogWarning("Backlink not found."); + Debug.LogWarning("Backlink not found. Removing link."); + links.RemoveAt(j); } } @@ -356,7 +357,7 @@ public int FindQuad(int face) var linkFrom = _faceLinks[faceOther][linkTo.backLinkIdx]; if (linkFrom.with != face) { - Debug.LogError("Bad backlinkIdx!"); + Debug.LogWarning("Bad backlinkIdx!"); } @@ -535,7 +536,7 @@ public HashSet FindLoop(int f1, int f2) break; }; } - if (jumpToFace == -1) Debug.LogError("Why is happening? no oppsite side found?"); + if (jumpToFace == -1) Debug.LogWarning("No opposite side found!"); f1 = f2_quadBro; f2 = jumpToFace; noOverlaps = result.Add(f1) && result.Add(f2);