Exemple #1
0
 public OctreeNode(float xMax, float xMin, float yMax, float yMin, float zMax, float zMin, int maximumItems, float minimumSize)
 {
     Bounds   = new OctreeBox(xMax, xMin, yMax, yMin, zMax, zMin);
     MaxItems = maximumItems;
     MinSize  = minimumSize;
     Items    = ArrayList.Synchronized(new ArrayList(10));
 }
Exemple #2
0
 public ArrayList GetNode(OctreeBox rect, ArrayList nodes)
 {
     if (Branch == null)
     {
         var things = Items.GetEnumerator();
         while (things.MoveNext())
         {
             var qtl = (OctreeLeaf <T>)things.Current;
             if (qtl != null && rect.PointWithinBounds(qtl.X, qtl.Y, qtl.Z))
             {
                 nodes.Add(qtl.LeafObject);
             }
         }
     }
     else
     {
         foreach (var t in Branch.Where(t => t.Bounds.Within(rect)))
         {
             t.GetNode(rect, nodes);
         }
     }
     return(nodes);
 }
Exemple #3
0
 public bool Within(OctreeBox box)
 {
     return(Within(box.Top, box.Left, box.Bottom, box.Right, box.Front, box.Back));
 }