SetSubNodes() public méthode

public SetSubNodes ( UQtNode, subNodes ) : void
subNodes UQtNode,
Résultat void
    public static void BuildRecursively(UQtNode node)
    {
        // parameters
        float subWidth   = node.Bound.width * 0.5f;
        float subHeight  = node.Bound.height * 0.5f;
        bool  isPartible = subWidth >= UQtConfig.CellSizeThreshold && subHeight >= UQtConfig.CellSizeThreshold;

        // create subnodes
        UQtCreateNode _nodeCreator = (bnd) => { return(new UQtNode(bnd)); };
        UQtCreateNode _leafCreator = (bnd) => { return(new UQtLeaf(bnd)); };
        UQtCreateNode creator      = isPartible ? _nodeCreator : _leafCreator;

        node.SetSubNodes(new UQtNode[UQtNode.SubCount] {
            creator(new Rect(node.Bound.xMin, node.Bound.yMin, subWidth, subHeight)),
            creator(new Rect(node.Bound.xMin + subWidth, node.Bound.yMin, subWidth, subHeight)),
            creator(new Rect(node.Bound.xMin, node.Bound.yMin + subHeight, subWidth, subHeight)),
            creator(new Rect(node.Bound.xMin + subWidth, node.Bound.yMin + subHeight, subWidth, subHeight)),
        });

        // do it recursively
        if (isPartible)
        {
            foreach (var sub in node.SubNodes)
            {
                BuildRecursively(sub);
            }
        }
    }
    public static void BuildRecursively(UQtNode node)
    {
        // parameters
        float subWidth = node.Bound.width * 0.5f;
        float subHeight = node.Bound.height * 0.5f;
        bool isPartible = subWidth >= UQtConfig.CellSizeThreshold && subHeight >= UQtConfig.CellSizeThreshold;

        // create subnodes
        UQtCreateNode _nodeCreator = (bnd) => { return new UQtNode(bnd); };
        UQtCreateNode _leafCreator = (bnd) => { return new UQtLeaf(bnd); };
        UQtCreateNode creator = isPartible ? _nodeCreator : _leafCreator;
        node.SetSubNodes(new UQtNode[UQtNode.SubCount] {
            creator(new Rect(node.Bound.xMin,             node.Bound.yMin,                subWidth, subHeight)),
            creator(new Rect(node.Bound.xMin + subWidth,  node.Bound.yMin,                subWidth, subHeight)),
            creator(new Rect(node.Bound.xMin,             node.Bound.yMin + subHeight,    subWidth, subHeight)),
            creator(new Rect(node.Bound.xMin + subWidth,  node.Bound.yMin + subHeight,    subWidth, subHeight)),
        });

        // do it recursively
        if (isPartible)
        {
            foreach (var sub in node.SubNodes)
            {
                BuildRecursively(sub);
            }
        }
    }