private void RRT() { if (tree.getCount() > numPoints) { calculating = false; return; } ArrayList carPath = freePath(tree.last.point, destination, tree.last.forward); if (carPath.Count > 0) { Debug.DrawLine(tree.last.point, destination, Color.blue, timeDebug, false); rrtNode d = new rrtNode(destination, tree.last); //tree.last.addConnection (d); d.forward = ((Vector3)carPath[carPath.Count - 1] - (Vector3)carPath[carPath.Count - 2]).normalized; tree.addNode(d); calculating = false; //path = rrTree.optimizePath(tree.getPath()); path = tree.getCarPath(); printPath(path); } else { addRandomNode(tree, dim); } }
private void RRT() { if (tree.getCount() > numPoints) { calculating = false; return; } if (freePath(tree.last.point, destination)) { Debug.DrawLine(tree.last.point, destination, Color.blue, timeDebug, false); rrtNode d = new rrtNode(destination, tree.last); tree.last.addConnection(d); tree.addNode(d); calculating = false; path = rrTree.optimizePath(tree.getPath()); printPath(path); } else { addRandomNode(tree, dim); } }