AddNode() public méthode

public AddNode ( OctreeLeaf, leaf ) : bool
leaf OctreeLeaf,
Résultat bool
Exemple #1
0
    public bool AddNode(OctreeLeaf leaf)
    {
        if (Branch == null)
        {
            Items.Add(leaf);
            if (Items.Count == 1)
            {
                AllTheSamePoint = true;
                FirstX          = leaf.X;
                FirstY          = leaf.Y;
                FirstZ          = leaf.Z;
            }
            else
            {
                if (FirstX != leaf.X || FirstY != leaf.Y || FirstZ != leaf.Z)
                {
                    AllTheSamePoint = false;
                }
            }

            if (Items.Count > MaxItems && !AllTheSamePoint)
            {
                Split();
            }
            return(true);
        }

        OctreeNode node = GetChild(leaf.X, leaf.Y, leaf.Z);

        return(node != null && node.AddNode(leaf));
    }
Exemple #2
0
 public bool AddNode(float x, float y, float z, object obj)
 {
     return(Top.AddNode(x, y, z, obj));
 }