Exemplo n.º 1
0
        protected override Cuboid FindDimensionsOfChild(OctreeNode <T> child)
        {
            Octant oct = FindOctantOfChild(child);

            int size = Size >> 1;

            return(new Cuboid(X + oct.X * size, Y + oct.Y * size, Z + oct.Z * size, size));
        }
Exemplo n.º 2
0
        protected virtual Cuboid FindDimensionsOfChild(OctreeNode <T> child)
        {
            Octant oct  = FindOctantOfChild(child);
            Cuboid dims = Parent.FindDimensionsOfChild(this);

            int size = dims.Width >> 1;

            return(new Cuboid(dims.X + oct.X * size, dims.Y + oct.Y * size, dims.Z + oct.Z * size, size));
        }
Exemplo n.º 3
0
        public bool MoveNext()
        {
            if (Node == null)
            {
                Node = myOriginal;
            }
            else
            {
                while (Node is OctreeLeaf <T> || myCurOctIndex == myValidOctants.Length)
                {
                    if (Node is Octree <T> )
                    {
                        return(false);
                    }

                    Node          = Node.Parent;
                    myCurOctIndex = myStack.Pop() + 1;

                    X ^= (X & Size);
                    Y ^= (Y & Size);
                    Z ^= (Z & Size);

                    Size <<= 1;
                }
            }

            while (Node is OctreeBranch <T> )
            {
                Octant oct = myValidOctants[myCurOctIndex];
                Node = ((OctreeBranch <T>)Node)[oct];
                myStack.Push(myCurOctIndex);
                myCurOctIndex = 0;

                Size >>= 1;

                X += oct.X * Size;
                Y += oct.Y * Size;
                Z += oct.Z * Size;
            }

            return(true);
        }
Exemplo n.º 4
0
 public OctreeNode <T> this[Octant octant]
 {
     get { return(myChildren[octant.Index]); }
 }
Exemplo n.º 5
0
        internal OctreeNode <T> FindNode(OctreeNode <T> child, int mSize, int oX, int oY, int oZ, int oSize)
        {
            Octant oct = FindOctantOfChild(child);

            return(FindNode(mSize << 1, oX + oct.X * mSize, oY + oct.Y * mSize, oZ + oct.Z * mSize, oSize));
        }