private void Start(double limit)
 {
     // initialize PQ with collision events and redraw event
     _pq = new MinPQ <Event>();
     for (int i = 0; i < _particles.Length; i++)
     {
         Predict(_particles[i], limit);
     }
     _pq.Insert(new Event(0, null, null)); // redraw event
 }
Ejemplo n.º 2
0
            // add all items to copy of heap
            // takes linear time since already in heap order so no keys move
            public HeapIterator(MinPQ <TKey> minPQ)
            {
                if (minPQ.mComparator == null)
                {
                    _copy = new MinPQ <TKey>(minPQ.Size());
                }
                else
                {
                    _copy = new MinPQ <TKey>(minPQ.Size(), minPQ.mComparator);
                }

                for (int i = 1; i <= minPQ._n; i++)
                {
                    _copy.Insert(minPQ._keys[i]);
                }
            }