OctreeNode.AddNode C# (CSharp) Method

AddNode() public method

public AddNode ( OctreeLeaf, leaf ) : bool
leaf OctreeLeaf,
return bool
    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);
    }

Same methods

OctreeNode::AddNode ( Vector3 vector, object obj ) : bool
OctreeNode::AddNode ( double x, double y, double z, object obj ) : bool
OctreeNode::AddNode ( float x, float y, float 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