Exemple #1
0
        private void CreateChildren()
        {
            if (IsLeaf)
            {
                // create each of the child octants
                for (int i = 0; i < 8; i++)
                {
                    children[i] = new Octant <T>(this, GetChildBounds(Bounds, (Boolean3)i));
                }

                IsLeaf = false;

                // relocate items which can fit in children octents
                foreach (var item in Items.FindAll(item => item.Radius <= Extent / 2))
                {
                    Items.Remove(item);
                    Add(item);
                }
            }
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 public Octant(Octant <T> parent, Bounds3 bounds)
 {
     Bounds    = bounds;
     Influence = Bounds3.FromCenter(bounds.Center, bounds.Size * 3);
 }
Exemple #3
0
 public Octree(Vector3 center, float side)
 {
     Bounds = Bounds3.FromCenter(center, new Vector3(side));
     Root   = new Octant <T>(null, Bounds);
 }