buildObstacleTree() private méthode

Builds an obstacle k-D tree.
private buildObstacleTree ( ) : void
Résultat void
Exemple #1
0
        /**
         * <summary>Performs a simulation step and updates the two-dimensional
         * position and two-dimensional velocity of each agent.</summary>
         *
         * <returns>The global time after the simulation step.</returns>
         */
        public IEnumerator doStep()
        {
            if (workers_ == null)
            {
                workers_    = new Worker[numWorkers_];
                doneEvents_ = new ManualResetEvent[workers_.Length];

                for (int block = 0; block < workers_.Length; ++block)
                {
                    doneEvents_[block] = new ManualResetEvent(false);
                    workers_[block]    = new Worker(block * getNumAgents() / workers_.Length, (block + 1) * getNumAgents() / workers_.Length, doneEvents_[block]);
                }
            }
            if (obstacleIsDirty)
            {
                kdTree_.buildObstacleTree();
                obstacleIsDirty = false;
            }
            kdTree_.buildAgentTree();

            for (int block = 0; block < workers_.Length; ++block)
            {
                doneEvents_[block].Reset();
                ThreadPool.QueueUserWorkItem(workers_[block].step);
            }

            WaitHandle.WaitAll(doneEvents_);

            for (int block = 0; block < workers_.Length; ++block)
            {
                doneEvents_[block].Reset();
                ThreadPool.QueueUserWorkItem(workers_[block].update);
            }

            WaitHandle.WaitAll(doneEvents_);
            yield return(null);
        }
Exemple #2
0
 /**
  * <summary>Processes the obstacles that have been added so that they
  * are accounted for in the simulation.</summary>
  *
  * <remarks>Obstacles added to the simulation after this function has
  * been called are not accounted for in the simulation.</remarks>
  */
 public void processObstacles()
 {
     kdTree_.buildObstacleTree();
 }
Exemple #3
0
 /**
  * <summary>Processes the obstacles that have been added so that they
  * are accounted for in the simulation.</summary>
  *
  * <remarks>Obstacles added to the simulation after this function has
  * been called are not accounted for in the simulation.</remarks>
  */
 internal void processObstacles()
 {
     kdTree_.buildObstacleTree();
 }