Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. public void fitBoxes(object box)
  2.         {
  3.             Box firstBox = (Box)box;
  4.             int current = findHighestMultipleOf2(firstBox.xDim, firstBox.yDim);
  5.  
  6.             int fitsX = (int)Math.Floor((decimal)(firstBox.xDim / current));
  7.             int fitsY = (int)Math.Floor((decimal)(firstBox.yDim / current));
  8.  
  9.             lock (lockMe)
  10.             {
  11.                 counter+= fitsX * fitsX;
  12.             }
  13.  
  14.             Box branch1 = new Box
  15.             {
  16.                 yDim = firstBox.yDim,
  17.                 xDim = firstBox.xDim - fitsX * current
  18.             };
  19.             Box branch2 = new Box
  20.             {
  21.                 yDim = firstBox.yDim - fitsY * current,
  22.                 xDim = firstBox.xDim,
  23.             };
  24.             waitcall = new WaitCallback(fitBoxes);
  25.             ThreadPool.QueueUserWorkItem(waitcall, branch1);
  26.             ThreadPool.QueueUserWorkItem(waitcall, branch2);
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement