Skip to content

Commit

Permalink
Removing links if backlink is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
piXelicidio committed Jun 15, 2023
1 parent 3cd08ea commit e953ae8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Painter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,16 @@ 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)
{
backlink.backLinkIdx = j;
} else
{
Debug.LogWarning("Backlink not found.");
Debug.LogWarning("Backlink not found. Removing link.");
links.RemoveAt(j);
}

}
Expand Down Expand Up @@ -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!");
}


Expand Down Expand Up @@ -535,7 +536,7 @@ public HashSet<int> 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);
Expand Down

0 comments on commit e953ae8

Please sign in to comment.