OctreeNode.AddNode C# (CSharp) Method

AddNode() public method

public AddNode ( float x, float y, float z, object obj ) : bool
x float
y float
z float
obj object
return bool
    public bool AddNode(float x, float y, float z, object obj)
    {
        return AddNode(new OctreeLeaf(x, y, z, obj));
    }

Same methods

OctreeNode::AddNode ( OctreeLeaf, leaf ) : bool
OctreeNode::AddNode ( Vector3 vector, object obj ) : bool
OctreeNode::AddNode ( double x, double y, double z, object obj ) : bool

Usage Example

Beispiel #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));
    }
All Usage Examples Of OctreeNode::AddNode