Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void fitBoxes(object box)
- {
- Box firstBox = (Box)box;
- int current = findHighestMultipleOf2(firstBox.xDim, firstBox.yDim);
- int fitsX = (int)Math.Floor((decimal)(firstBox.xDim / current));
- int fitsY = (int)Math.Floor((decimal)(firstBox.yDim / current));
- lock (lockMe)
- {
- counter+= fitsX * fitsX;
- }
- Box branch1 = new Box
- {
- yDim = firstBox.yDim,
- xDim = firstBox.xDim - fitsX * current
- };
- Box branch2 = new Box
- {
- yDim = firstBox.yDim - fitsY * current,
- xDim = firstBox.xDim,
- };
- waitcall = new WaitCallback(fitBoxes);
- ThreadPool.QueueUserWorkItem(waitcall, branch1);
- ThreadPool.QueueUserWorkItem(waitcall, branch2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement