A node of the random binary space partionning tree.
More...
#include <gf/RandomBinaryTree.h>
A node of the random binary space partionning tree.
◆ Node()
gf::RandomBinaryTree::Node::Node |
( |
const RectI & |
area, |
|
|
std::size_t |
parent, |
|
|
int |
level |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
area | The area of the node |
parent | The index of the parent node |
level | The level of the node |
◆ contains()
bool gf::RandomBinaryTree::Node::contains |
( |
Vector2i |
position | ) |
const |
|
inline |
Check if the area of the node contains a position.
- Parameters
-
position | The position to check |
◆ getArea()
const RectI & gf::RandomBinaryTree::Node::getArea |
( |
| ) |
const |
|
inline |
Get the area of the node.
- Returns
- The area of the node
◆ getLeftChildIndex()
std::size_t gf::RandomBinaryTree::Node::getLeftChildIndex |
( |
| ) |
const |
|
inline |
Get the left child's index.
- Returns
- The left child's index if it exists or 0
◆ getLevel()
int gf::RandomBinaryTree::Node::getLevel |
( |
| ) |
const |
|
inline |
Get the level of the node in the tree.
The root of the tree is at level 0, its children at level 1, etc.
- Returns
- The level of the node
◆ getParentIndex()
std::size_t gf::RandomBinaryTree::Node::getParentIndex |
( |
| ) |
const |
|
inline |
Get the parent's indes of the node.
The root of the tree is its own parent.
- Returns
- The parent's index of the node
◆ getRightChildIndex()
std::size_t gf::RandomBinaryTree::Node::getRightChildIndex |
( |
| ) |
const |
|
inline |
Get the right child's index.
- Returns
- The right child's index if it exists or 0
◆ isLeaf()
bool gf::RandomBinaryTree::Node::isLeaf |
( |
| ) |
const |
|
inline |
Check if a node is a leaf.
A leaf has no children.
- Returns
- True if the node is a leaf
◆ setChildrenIndices()
void gf::RandomBinaryTree::Node::setChildrenIndices |
( |
std::size_t |
left, |
|
|
std::size_t |
right |
|
) |
| |
|
inline |
Set the children indices of the node.
- Parameters
-
left | The index of the left child |
right | The index of the right child |