A node in the dynamic tree. More...
#include <DynamicTree.hpp>
Public Member Functions | |
~TreeNode ()=default | |
PLAYRHO_CONSTEXPR | TreeNode (const TreeNode &other)=default |
Copy constructor. More... | |
PLAYRHO_CONSTEXPR | TreeNode (TreeNode &&other)=default |
Move constructor. More... | |
PLAYRHO_CONSTEXPR | TreeNode (Size other=DynamicTree::GetInvalidSize()) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | TreeNode (const LeafData &value, AABB aabb, Size other=DynamicTree::GetInvalidSize()) noexcept |
Initializing constructor. More... | |
PLAYRHO_CONSTEXPR | TreeNode (const BranchData &value, AABB aabb, Height height, Size other=DynamicTree::GetInvalidSize()) noexcept |
Initializing constructor. More... | |
TreeNode & | operator= (const TreeNode &other)=default |
Copy assignment operator. More... | |
PLAYRHO_CONSTEXPR Height | GetHeight () const noexcept |
Gets the node "height". More... | |
PLAYRHO_CONSTEXPR Size | GetOther () const noexcept |
Gets the node's "other" index. More... | |
PLAYRHO_CONSTEXPR void | SetOther (Size other) noexcept |
Sets the node's "other" index to the given value. More... | |
PLAYRHO_CONSTEXPR AABB | GetAABB () const noexcept |
Gets the node's AABB. More... | |
PLAYRHO_CONSTEXPR void | SetAABB (AABB value) noexcept |
Sets the node's AABB. More... | |
PLAYRHO_CONSTEXPR UnusedData | AsUnused () const noexcept |
Gets the node as an "unused" value. More... | |
PLAYRHO_CONSTEXPR LeafData | AsLeaf () const noexcept |
Gets the node as a "leaf" value. More... | |
PLAYRHO_CONSTEXPR BranchData | AsBranch () const noexcept |
Gets the node as a "branch" value. More... | |
PLAYRHO_CONSTEXPR void | Assign (const UnusedData &v) noexcept |
Gets the node as an "unused" value. More... | |
PLAYRHO_CONSTEXPR void | Assign (const LeafData &v) noexcept |
Gets the node as a "leaf" value. More... | |
PLAYRHO_CONSTEXPR void | Assign (const BranchData &v, const AABB &bb, Height h) noexcept |
Assigns the node as a "branch" value. More... | |
Related Functions | |
(Note that these are not member functions.) | |
PLAYRHO_CONSTEXPR bool | IsUnused (const DynamicTree::TreeNode &node) noexcept |
Is unused. More... | |
PLAYRHO_CONSTEXPR bool | IsLeaf (const DynamicTree::TreeNode &node) noexcept |
Is leaf. More... | |
PLAYRHO_CONSTEXPR bool | IsBranch (const DynamicTree::TreeNode &node) noexcept |
Is branch. More... | |
PLAYRHO_CONSTEXPR bool | IsUnused (const DynamicTree::TreeNode &node) noexcept |
Whether this node is free (or allocated). More... | |
PLAYRHO_CONSTEXPR bool | IsLeaf (const DynamicTree::TreeNode &node) noexcept |
Whether or not this node is a leaf node. More... | |
PLAYRHO_CONSTEXPR bool | IsBranch (const DynamicTree::TreeNode &node) noexcept |
Is branch. More... | |
PLAYRHO_CONSTEXPR AABB | GetAABB (const DynamicTree::TreeNode &node) noexcept |
Gets the AABB of the given dynamic tree node. More... | |
PLAYRHO_CONSTEXPR DynamicTree::Size | GetNext (const DynamicTree::TreeNode &node) noexcept |
Gets the next index of the given node. More... | |
Detailed Description
A node in the dynamic tree.
- Note
- Users do not interact with this directly.
- By using indexes to other tree nodes, these don't need to be updated if the memory for other nodes is relocated.
- On some 64-bit architectures, pointers are 8-bytes, while indices need only be 4-bytes. So using indices can also save 4-bytes.
- This data structure is 48-bytes large on at least one 64-bit platform.
Definition at line 395 of file DynamicTree.hpp.
Constructor & Destructor Documentation
◆ ~TreeNode()
|
default |
◆ TreeNode() [1/5]
|
inlinedefault |
Copy constructor.
◆ TreeNode() [2/5]
|
inlinedefault |
Move constructor.
◆ TreeNode() [3/5]
|
inlineexplicitnoexcept |
Initializing constructor.
Definition at line 407 of file DynamicTree.hpp.
◆ TreeNode() [4/5]
|
inlinenoexcept |
Initializing constructor.
Definition at line 414 of file DynamicTree.hpp.
◆ TreeNode() [5/5]
|
inlinenoexcept |
Initializing constructor.
Definition at line 422 of file DynamicTree.hpp.
Member Function Documentation
◆ operator=()
Copy assignment operator.
◆ GetHeight()
|
inlinenoexcept |
Gets the node "height".
Definition at line 435 of file DynamicTree.hpp.
◆ GetOther()
|
inlinenoexcept |
Gets the node's "other" index.
Definition at line 441 of file DynamicTree.hpp.
◆ SetOther()
|
inlinenoexcept |
Sets the node's "other" index to the given value.
Definition at line 447 of file DynamicTree.hpp.
◆ GetAABB()
|
inlinenoexcept |
Gets the node's AABB.
- Warning
- Behavior is undefined if called on a free/unused node!
Definition at line 454 of file DynamicTree.hpp.
◆ SetAABB()
|
inlinenoexcept |
Sets the node's AABB.
- Warning
- Behavior is undefined if called on a free/unused node!
Definition at line 462 of file DynamicTree.hpp.
◆ AsUnused()
|
inlinenoexcept |
Gets the node as an "unused" value.
- Warning
- Behavior is undefined unless called on a free/unused node!
Definition at line 470 of file DynamicTree.hpp.
◆ AsLeaf()
|
inlinenoexcept |
Gets the node as a "leaf" value.
- Warning
- Behavior is undefined unless called on a leaf node!
Definition at line 478 of file DynamicTree.hpp.
◆ AsBranch()
|
inlinenoexcept |
Gets the node as a "branch" value.
- Warning
- Behavior is undefined unless called on a branch node!
Definition at line 486 of file DynamicTree.hpp.
◆ Assign() [1/3]
|
inlinenoexcept |
Gets the node as an "unused" value.
Definition at line 493 of file DynamicTree.hpp.
◆ Assign() [2/3]
|
inlinenoexcept |
Gets the node as a "leaf" value.
Definition at line 500 of file DynamicTree.hpp.
◆ Assign() [3/3]
|
inlinenoexcept |
Assigns the node as a "branch" value.
Definition at line 507 of file DynamicTree.hpp.
Friends And Related Function Documentation
◆ IsUnused() [1/2]
|
related |
Is unused.
Determines whether the given dynamic tree node is an unused node.
Definition at line 631 of file DynamicTree.hpp.
◆ IsLeaf() [1/2]
|
related |
Is leaf.
Determines whether the given dynamic tree node is a leaf node. Leaf nodes have a pointer to user data.
Definition at line 640 of file DynamicTree.hpp.
◆ IsBranch() [1/2]
|
related |
Is branch.
Determines whether the given dynamic tree node is a branch node. Branch nodes have 2 indices to child nodes.
Definition at line 648 of file DynamicTree.hpp.
◆ IsUnused() [2/2]
|
related |
Whether this node is free (or allocated).
Definition at line 631 of file DynamicTree.hpp.
◆ IsLeaf() [2/2]
|
related |
Whether or not this node is a leaf node.
- Note
- This has constant complexity.
- Returns
true
if this is a leaf node,false
otherwise.
Definition at line 640 of file DynamicTree.hpp.
◆ IsBranch() [2/2]
|
related |
Is branch.
Determines whether the given node is a "branch" node.
Definition at line 648 of file DynamicTree.hpp.
◆ GetAABB()
|
related |
Gets the AABB of the given dynamic tree node.
Definition at line 655 of file DynamicTree.hpp.
◆ GetNext()
|
related |
Gets the next index of the given node.
- Warning
- Behavior is undefined if the given node is not an "unused" node.
Definition at line 664 of file DynamicTree.hpp.
The documentation for this class was generated from the following file:
- Collision/DynamicTree.hpp