< index < 14. BSP toolkit < 14.2 Splitting a BSP tree | ===================================== 14.3 Resizing a BSP tree ===================================== | > 14.4 Reading information from the tree

This operation resets the size of the tree nodes without changing the splitting data (orientation/position). It should be called with the initial region size or a bigger size, else some splitting position may be out of the region.
You can use it if you changed the nodes size and position while using the BSP tree, which happens typically when you use the tree to build a dungeon. You create rooms inside the tree leafs, then shrink the leaf to fit the room size. Calling resize on the root node with the original region size allows you to reset all nodes to their original size.

    C++ : void TCODBsp::resize(int x,int y, int w, int h)
    C   : void TCOD_bsp_resize(TCOD_bsp_t *node, int x,int y, int w, int h)
    Py  : bsp_resize(node,  x,y, w, h)

Parameter | Description
--- | ---
node | In the C version, the root node created with TCOD_bsp_new_with_size, or a node obtained by splitting.
x,y,w,h | New position and size of the node. The original rectangular area covered by the node should be included in the new one to ensure that every splitting edge stay inside its node.

Example :
We create a BSP, do some processing that will modify the x,y,w,h fields of the tree nodes, then reset all the nodes to their original size.

    C++ : TCODBsp *myBSP = new TCODBsp(0,0,50,50);
          myBSP->splitRecursive(NULL,4,5,5,1.5f,1.5f);
          // ... do something with the tree here
          myBSP->resize(0,0,50,50);
    C   : TCOD_bsp_t *my_bsp=TCOD_bsp_new_with_size(0,0,50,50);
          TCOD_bsp_split_recursive(my_bsp,NULL,4,5,5,1.5f,1.5f);
          /* ... do something with the tree here */
          TCOD_bsp_resize(my_bsp,0,0,50,50);
    Py  : my_bsp=libtcod.bsp_new_with_size(0,0,50,50)
          libtcod.bsp_split_recursive(my_bsp,0,4,5,5,1.5,1.5)
          # ... do something with the tree here
          libtcod.bsp_resize(my_bsp,0,0,50,50)