Beispiel #1
0
            public Enumerator(MyVector3DGrid <T> parent, ref Vector3D point, double dist)
            {
                this.m_parent = parent;
                this.m_point  = point;
                this.m_distSq = dist * dist;
                Vector3D vectord = new Vector3D(dist);
                Vector3I start   = Vector3I.Floor((Vector3D)((point - vectord) * parent.m_divisor));
                Vector3I end     = Vector3I.Floor((Vector3D)((point + vectord) * parent.m_divisor));

                this.m_rangeIterator = new Vector3I_RangeIterator(ref start, ref end);
                this.m_previousIndex = -1;
                this.m_storageIndex  = -1;
            }
            public Enumerator(MyVector3DGrid <T> parent, ref Vector3D point, double dist)
            {
                m_parent = parent;
                m_point  = point;
                m_distSq = dist * dist;

                Vector3D offset = new Vector3D(dist);
                Vector3I start  = Vector3I.Floor((point - offset) * parent.m_divisor);
                Vector3I end    = Vector3I.Floor((point + offset) * parent.m_divisor);

                m_rangeIterator = new Vector3I_RangeIterator(ref start, ref end);

                m_previousIndex = -1;
                m_storageIndex  = -1;
            }
Beispiel #3
0
 private bool FindFirstAcceptableEntry()
 {
     do
     {
         while (this.m_storageIndex != -1)
         {
             MyVector3DGrid <T> .Entry entry = this.m_parent.m_storage[this.m_storageIndex];
             Vector3D vectord = entry.Point - this.m_point;
             if (vectord.LengthSquared() < this.m_distSq)
             {
                 return(true);
             }
             this.m_previousIndex = this.m_storageIndex;
             this.m_storageIndex  = entry.NextEntry;
         }
         this.m_rangeIterator.MoveNext();
     }while (this.FindNextNonemptyBin());
     return(false);
 }
Beispiel #4
0
 public bool RemoveCurrent()
 {
     this.m_storageIndex = this.m_parent.RemoveEntry(this.m_storageIndex);
     if (this.m_previousIndex == -1)
     {
         if (this.m_storageIndex == -1)
         {
             this.m_parent.m_bins.Remove(this.m_rangeIterator.Current);
         }
         else
         {
             this.m_parent.m_bins[this.m_rangeIterator.Current] = this.m_storageIndex;
         }
     }
     else
     {
         MyVector3DGrid <T> .Entry entry = this.m_parent.m_storage[this.m_previousIndex];
         entry.NextEntry = this.m_storageIndex;
         this.m_parent.m_storage[this.m_previousIndex] = entry;
     }
     return(this.FindFirstAcceptableEntry());
 }