Ejemplo n.º 1
0
    private void RRT()
    {
        if (tree.getCount() > numPoints)
        {
            calculating = false;
            return;
        }

        ArrayList dubinConn = freePath(tree.last.point, destination);

        if (dubinConn.Count > 0)
        {
            Debug.DrawLine(tree.last.point, destination, Color.blue, timeDebug, false);
            rrtNode d = new rrtNode(destination, tree.last);
            //d.connection = dubinConn;
            tree.addNode(d);
            calculating = false;
            //path = rrTree.optimizePath(tree.getPath());
            path = tree.getPath();
            //printPath (path);
        }
        else
        {
            addRandomNode(tree, dim);
        }
    }
Ejemplo n.º 2
0
    private void RRT()
    {
        //if(onePoint) { onePoint=false; addFixedPoint(new Vector3(-12f, 1.5f, 3f)); return;}
        //if(twoPoint) { twoPoint=false; addFixedPoint(new Vector3(-14f, 1.5f, -18f)); return;}

        ArrayList dubinWay = freeCarPath(tree.last.point, tree.last.forward, destination);

        draw.drawLine(tree.last.point, destination, Color.blue);
        if (dubinWay.Count > 0)
        {
            rrtNode d = new rrtNode(destination, tree.last);
            dubinWay.Reverse();
            d.connection = dubinWay;
            //draw.drawMultipleLines (d.connection, Color.magenta);
            d.forward = ((Vector3)dubinWay[dubinWay.Count - 1] - (Vector3)dubinWay[dubinWay.Count - 2]).normalized;
            tree.addNode(d);
            calculating = false;
            path        = tree.getPath();
            draw.drawMultipleLines(path, Color.magenta);
        }
        else
        {
            //if(onePoint) { onePoint=false; addRandomNode (tree, dimX, dimZ); }
            //addRandomNode (tree, dimX, dimZ);
        }
    }