MaxAllowedSize() static private method

static private MaxAllowedSize ( int numNodes, int depth ) : int
numNodes int
depth int
return int
Ejemplo n.º 1
0
 private void Add(GraphNode point, int index, int depth = 0)
 {
     while (this.tree[index].data == null)
     {
         index = 2 * index + ((point.position[(int)this.tree[index].splitAxis] >= this.tree[index].split) ? 1 : 0);
         depth++;
     }
     this.tree[index].data.Add(point);
     if (this.tree[index].data.Count > PointKDTree.LeafSize * 2)
     {
         int num = 0;
         while (depth - num > 0 && this.Size(index >> num) > PointKDTree.MaxAllowedSize(this.numNodes, depth - num))
         {
             num++;
         }
         this.Rebalance(index >> num);
     }
 }
Ejemplo n.º 2
0
        // Token: 0x06002676 RID: 9846 RVA: 0x001AAC1C File Offset: 0x001A8E1C
        private void Add(GraphNode point, int index, int depth = 0)
        {
            while (this.tree[index].data == null)
            {
                index = 2 * index + ((point.position[(int)this.tree[index].splitAxis] < this.tree[index].split) ? 0 : 1);
                depth++;
            }
            GraphNode[]        data  = this.tree[index].data;
            PointKDTree.Node[] array = this.tree;
            int    num   = index;
            ushort count = array[num].count;

            array[num].count = count + 1;
            data[(int)count] = point;
            if (this.tree[index].count >= 21)
            {
                int num2 = 0;
                while (depth - num2 > 0 && this.Size(index >> num2) > PointKDTree.MaxAllowedSize(this.numNodes, depth - num2))
                {
                    num2++;
                }
                this.Rebalance(index >> num2);
            }
        }