public void Begin() { branchInContour[0] = new List <CVisitedBranch>(); branchInContour[1] = new List <CVisitedBranch>(); sideOfContour = EContourSide.LEFT; index = 0; }
public bool Next(out CVisitedBranch branch, out CVisitedNode node, Dictionary <long, CVisitedNode> visitedNodes, byte phaseIndex) { switch (sideOfContour) { case (sbyte)EContourSide.LEFT: { branch = branchInContour[0][index]; node = visitedNodes[branch.UpNode[phaseIndex]]; if (index < branchInContour[0].Count - 1) { index++; } else { sideOfContour = EContourSide.RIGHT; index = branchInContour[1].Count - 1; } return(true); } case EContourSide.RIGHT: { branch = branchInContour[1][index]; node = visitedNodes[branch.UpNode[phaseIndex]]; if (index > 0) { index--; } else { sideOfContour = EContourSide.UNKNOWN; } return(true); } default: { node = null; branch = null; return(false); } } }