public static VoronoiEdgeNode GetLeftParentEdge(VoronoiNode node)
    {
        VoronoiNode returnNode    = node.mParent;
        VoronoiNode travelledNode = node;

        if (returnNode == null)
        {
            Debug.Log("null");
        }
        while (returnNode.mLeft == travelledNode)
        {
            if (returnNode.mParent == null)
            {
                return(null);
            }
            travelledNode = returnNode;
            returnNode    = returnNode.mParent;
        }
        if (returnNode.GetType() == typeof(VoronoiEdgeNode))
        {
            return((VoronoiEdgeNode)returnNode);
        }
        else
        {
            Debug.Log("Failed to get EdgeNode from GetLeftParentArc");
            return(null);
        }
    }
示例#2
0
    public VoronoiArcNode GetParabolaUnderNew(float newSiteX)
    {
        VoronoiNode checkNode = root;
        float       xCoord    = 0.0f;

        while (checkNode.hasChildren())
        {
            xCoord = GetXCoord(checkNode, sweepY);
            if (xCoord > newSiteX)
            {
                checkNode = checkNode.mLeft;
            }
            else
            {
                checkNode = checkNode.mRight;
            }
        }

        if (checkNode.GetType() == typeof(VoronoiArcNode))
        {
            return((VoronoiArcNode)checkNode);
        }
        else
        {
            Debug.Log("Failed to get ArcNode on GetParabolaUnderNew");
            return(null);
        }
    }
    public static VoronoiArcNode GetLeftChildArc(VoronoiNode node)
    {
        if (node == null)
        {
            return(null);
        }
        VoronoiNode returnNode = node.mLeft;

        while (returnNode.hasChildren())
        {
            returnNode = returnNode.mRight;
        }
        if (returnNode.GetType() == typeof(VoronoiArcNode))
        {
            return((VoronoiArcNode)returnNode);
        }
        Debug.Log("Failed to get ArcNode from GetLeftChildArc");
        return(null);
    }