private void ConstructAllPathTree(List <PolyLog> logs, PolyNode parentOfParent, ref PolyNode parentNode) { //EntraDrawer.DrawIntoFileTesting(logs[1].Poly); var compParent = parentNode.PolyLog.Comp; var newChilds = GetIntersectedPoly(parentOfParent.PolyLog, parentNode.PolyLog, logs); parentNode.AddChilds(newChilds); for (int i = 0; i < parentNode.Childs.Count; i++) { PolyNode child = parentNode.Childs[i]; var compChild = child.PolyLog.Comp; if (!IsInParent(child)) { // DEBUG //FrogEntityPoly frog = new FrogEntityPoly(this._entra, this._entra.EngineState.FrogRB); //var pathPoints = BuildPath(new PolyLog(frog, frog.GetDefPoly()), _allPaths[]); //var form = new PathForm(pathPoints); //form.DrawPathIntoOutput("pathDEBUG.jpg"); if (!(child.PolyLog.Comp is RopeEntityPoly)) { ConstructAllPathTree(logs, parentNode, ref child); } } } }
private List <PolyLog> GetPath(PolyNode end) { List <PolyLog> path = new List <PolyLog>(); var nodeIter = end; while (nodeIter.Parent != null) { path.Add(nodeIter.PolyLog); nodeIter = nodeIter.Parent; } return(path); }
private bool IsInParent(PolyNode child) { var childIter = child.Parent; while (childIter != null) { if (child.PolyLog.Comp == childIter.PolyLog.Comp) { return(true); } childIter = childIter.Parent; } return(false); }
public List <List <PolyLog> > SetAllPaths() { //BuildPath(); PolyNode baseNode = new PolyNode(_frogPolyLog, null); ConstructAllPathTree(this._log, new PolyNode(null, null), ref baseNode); List <PolyNode> pathEnds = new List <PolyNode>(); GetTreeEnds(baseNode, ref pathEnds); BuildTreePaths(pathEnds, ref AllPaths); DeleteSamePaths(ref AllPaths); ReAddFrogToAllPaths(_frogPolyLog, ref AllPaths); return(AllPaths); }
private void GetTreeEnds(PolyNode parentNode, ref List <PolyNode> pathEnds) { foreach (PolyNode child in parentNode.Childs) { if (child.Childs.Count != 0) { GetTreeEnds(child, ref pathEnds); } else { if (child.PolyLog.Comp is RopeEntityPoly) { pathEnds.Add(child); } } } }