public void AdvanceClosestBackwards() { PathTriangle closest = backwardsTails.Dequeue(); List <PathTriangle> circumjacent = closest.GetReachableCircumjacent(); PathTriangle t; int count = circumjacent.Count; for (int i = 0; i < count; ++i) { t = circumjacent[i]; if (t.LastUsedInBackwardsPathIteration < pathIteration) { if (t.LastUsedInPathIteration >= pathIteration) { reachedTarget = true; forwardPath = t; backwardsPath = closest; break; } else { t.SetUsedInBackwardsPathIteration(pathIteration); t.pathParent = closest; t.prevDistance = closest.prevDistance + closest.DistanceTo(t); AddTailUnchecked(t, backwardsTails); } } } }
public Path Advance(PathTriangle t) { return(new Path(t, this, previousDistance + t.DistanceTo(current))); }