/* try to merge adjacent regions */
if (b[i].x == box->x + box->width) {
b[i].x -= box->width;
+ b[i].width += box->width;
return;
}
if (b[i].x + b[i].width == box->x) {
if (b[i].y == box->y && b[i].height == box->height) {
if (b[i].x == box->x + box->width) {
b[i].x -= box->width;
+ b[i].width += box->width;
return;
}
if (b[i].x + b[i].width == box->x) {
} else if (b[i].x == box->x && b[i].width == box->width) {
if (b[i].y == box->y + box->height) {
b[i].y -= box->height;
+ b[i].height += box->height;
return;
}
if (b[i].y + b[i].height == box->y) {
if (b[i].y == box->y && b[i].height == box->height) {
if (b[i].x == box->x + box->width) {
b[i].x -= box->width;
+ b[i].width += box->width;
return;
}
if (b[i].x + b[i].width == box->x) {
} else if (b[i].x == box->x && b[i].width == box->width) {
if (b[i].y == box->y + box->height) {
b[i].y -= box->height;
+ b[i].height += box->height;
return;
}
if (b[i].y + b[i].height == box->y) {
if (b[i].y == box->y && b[i].height == box->height) {
if (b[i].z == box->z + box->depth) {
b[i].z -= box->depth;
+ b[i].depth += box->depth;
return;
}
if (b[i].z + b[i].depth == box->z) {
} else if (b[i].z == box->z && b[i].depth == box->depth) {
if (b[i].y == box->y + box->height) {
b[i].y -= box->height;
+ b[i].height += box->height;
return;
}
if (b[i].y + b[i].height == box->y) {
if (b[i].z == box->z && b[i].depth == box->depth) {
if (b[i].x == box->x + box->width) {
b[i].x -= box->width;
+ b[i].width += box->width;
return;
}
if (b[i].x + b[i].width == box->x) {
} else if (b[i].x == box->x && b[i].width == box->width) {
if (b[i].z == box->z + box->depth) {
b[i].z -= box->depth;
+ b[i].depth += box->depth;
return;
}
if (b[i].z + b[i].depth == box->z) {