Example #1
0
 public void AllocateBuffers(int trianglesNum)
 {
     if (this.lsHash == null || this.lsHash.Capacity() < trianglesNum * 2)
     {
         this.midPoints = new ArrayDictionary <Contour.MidPoint>(trianglesNum * 2);
         this.contour   = new List <Dictionary <int, int> >();
         this.lsHash    = new LSHash(1f / 1000f, trianglesNum * 2);
     }
     else
     {
         this.lsHash.Clear();
         foreach (Dictionary <int, int> dictionary in this.contour)
         {
             dictionary.Clear();
         }
         this.contour.Clear();
         if (this.midPoints.Size < trianglesNum * 2)
         {
             this.midPoints = new ArrayDictionary <Contour.MidPoint>(trianglesNum * 2);
         }
         else
         {
             this.midPoints.Clear();
         }
     }
 }
Example #2
0
        public void AllocateBuffers(int trianglesNum)
        {
            if (lsHash == null || lsHash.Capacity() < trianglesNum * 2)
            {
//                Utils.Log("Allocating contour: " + trianglesNum);

                midPoints = new ArrayDictionary <MidPoint>(trianglesNum * 2);
                contour   = new List <Dictionary <int, int> >();
                lsHash    = new LSHash(0.001f, trianglesNum * 2);
            }
            else
            {
                lsHash.Clear();
                foreach (var item in contour)
                {
                    item.Clear();
                }
                contour.Clear();

                if (midPoints.Size < trianglesNum * 2)
                {
//                    Utils.Log("Re-allocating midPoint: " + trianglesNum);

                    midPoints = new ArrayDictionary <MidPoint>(trianglesNum * 2);
                }
                else
                {
                    midPoints.Clear();
                }
            }
        }