Exemplo n.º 1
0
        public OctagonalVector AllocateNode(OctagonalVector v, OctantNode node)
        {
            lock (this)
            {
                if (_root == null)
                {
                    _rootVector = v;
                    _depth      = 0;
                    _root       = node;
                    return(new OctagonalVector(0, 0, 0));
                }

                OctagonalVector dV = AllocateLowerBoundRoot(v);

                AllocateVector(dV.CalculatePath(), node);

                return(dV);
            }
        }
Exemplo n.º 2
0
        void AllocateVector(List <int> vPath, OctantNode node)
        {
            int vectorPosition = vPath.Count();

            //AllocateUpperBoundRoot
            while (_depth < vPath.Count)
            {
                _root = new Octant(0, _root); _depth++;
            }

            //Find Octant
            Octant current = _root;

            //Skip missing (zero Octant) path coordinates
            int vectorDimension = _depth - 1;

            while (vectorDimension > 0 && vectorPosition <= vectorDimension)
            {
                current = current.GetOrAllocate(0); vectorDimension--;
            }

            //Find the path
            while (vectorDimension > 0)
            {
                current = current.GetOrAllocate(vPath[vectorDimension--]);
            }

            if (vectorPosition > 0)
            {
                current[vPath[0]] = node;
            }
            else
            {
                current[0] = node;
            }
        }
Exemplo n.º 3
0
 public OctagonalVector AllocateNode(Vector3 v, OctantNode node)
 {
     return(AllocateNode(new OctagonalVector(v), node));
 }