static unsafe PackingNode *ResetNode(PackingNode *node, int x, int y, int w, int h) { node->Used = false; node->Rect = new RectInt(x, y, w, h); node->Right = null; node->Down = null; return(node); }
static unsafe PackingNode *FindNode(PackingNode *root, int w, int h) { if (root->Used) { var r = FindNode(root->Right, w, h); return(r != null ? r : FindNode(root->Down, w, h)); } else if (w <= root->Rect.Width && h <= root->Rect.Height) { return(root); } return(null); }