All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Attributes | List of all members
SurgSim::DataStructures::AabbTreeNode Class Reference

Node class for the AabbTree, this handles groups of items and subdivision if the number of items gets too big. More...

#include <SurgSim/DataStructures/AabbTreeNode.h>

Inheritance diagram for SurgSim::DataStructures::AabbTreeNode:
Inheritance graph
[legend]
Collaboration diagram for SurgSim::DataStructures::AabbTreeNode:
Collaboration graph
[legend]

Public Member Functions

 AabbTreeNode ()
 Constructor. More...
 
virtual ~AabbTreeNode ()
 Destructor. More...
 
void splitNode ()
 Splits the data into two parts, creates two children and puts the split data into the children the aabb of this node does not change, the data of this node will be empty after this. More...
 
const SurgSim::Math::AabbdgetAabb () const
 Get the aabb of this node, it is the union of the aabb of all the items in the data when the node has data, or all the union of the aabb trees of all the sub-nodes. More...
 
void addData (const SurgSim::Math::Aabbd &aabb, size_t id, size_t maxNodeData=-1)
 Add data to this node, if maxNodeData is >0 the node will split if the number of data items exceeds maxNodeData. More...
 
void getIntersections (const SurgSim::Math::Aabbd &aabb, std::list< size_t > *result)
 Fetch a list of items that have AABBs intersecting with the given AABB. More...
 
- Public Member Functions inherited from SurgSim::DataStructures::TreeNode
 TreeNode ()
 Constructor. After construction, the node has no children, and the data is null. More...
 
virtual ~TreeNode ()
 Destructor. More...
 
void setData (std::shared_ptr< TreeData > data)
 Sets the data of this node. More...
 
std::shared_ptr< TreeDatagetData () const
 
size_t getNumChildren () const
 
std::shared_ptr< TreeNodegetChild (size_t index) const
 Returns the specified child of this node. More...
 
void accept (TreeVisitor *visitor)
 Public entry point for visitor, currently this performs pre-order traversal of the tree. More...
 
bool operator== (const TreeNode &node) const
 Returns true if the nodes are equal; otherwise, returns false. More...
 
bool operator!= (const TreeNode &node) const
 Returns true if the nodes are not equal; otherwise, returns false. More...
 

Protected Member Functions

virtual bool doAccept (TreeVisitor *visitor) override
 Private function for use with the visitor pattern, this needs to be implemented to make the correct double dispatch call to the dynamic type of this class. More...
 
- Protected Member Functions inherited from SurgSim::DataStructures::TreeNode
virtual bool isEqual (const TreeNode &node) const
 Returns true if the nodes are equal; otherwise, returns false. More...
 
void setNumChildren (size_t numChildren)
 Sets the number of children of this node. More...
 
void addChild (const std::shared_ptr< TreeNode > &node)
 Add a child to this node. More...
 
void addChild (const std::shared_ptr< TreeNode > &&node)
 Add a child to this node. More...
 
void setChild (size_t index, const std::shared_ptr< TreeNode > &node)
 Set a specific child of this node. More...
 

Private Attributes

SurgSim::Math::Aabbd m_aabb
 The internal bounding box for this node, it is used when the node does not have any data. More...
 
size_t m_axis
 Cache for the index of the longest axis on this node. More...
 

Detailed Description

Node class for the AabbTree, this handles groups of items and subdivision if the number of items gets too big.

Constructor & Destructor Documentation

SurgSim::DataStructures::AabbTreeNode::AabbTreeNode ( )

Constructor.

SurgSim::DataStructures::AabbTreeNode::~AabbTreeNode ( )
virtual

Destructor.

Member Function Documentation

void SurgSim::DataStructures::AabbTreeNode::addData ( const SurgSim::Math::Aabbd aabb,
size_t  id,
size_t  maxNodeData = -1 
)

Add data to this node, if maxNodeData is >0 the node will split if the number of data items exceeds maxNodeData.

Parameters
aabbThe aabb for the item to be added.
idThe id for the item that is being added, handled by the user of this class.
maxNodeDatanumber of maximum items of data in this node, if more, the node will split, if -1 the node will not be split.
bool SurgSim::DataStructures::AabbTreeNode::doAccept ( TreeVisitor visitor)
overrideprotectedvirtual

Private function for use with the visitor pattern, this needs to be implemented to make the correct double dispatch call to the dynamic type of this class.

Parameters
visitorThe visitor that is trying to traverse the tree.
Returns
true to indicate proceeding with the visitor, false indicates to abort the traversal.

Implements SurgSim::DataStructures::TreeNode.

const SurgSim::Math::Aabbd & SurgSim::DataStructures::AabbTreeNode::getAabb ( ) const

Get the aabb of this node, it is the union of the aabb of all the items in the data when the node has data, or all the union of the aabb trees of all the sub-nodes.

Returns
The aabb box of this node.
void SurgSim::DataStructures::AabbTreeNode::getIntersections ( const SurgSim::Math::Aabbd aabb,
std::list< size_t > *  result 
)

Fetch a list of items that have AABBs intersecting with the given AABB.

Parameters
aabbThe bounding box for the query.
[out]resultlocation to receive the results of the call.
void SurgSim::DataStructures::AabbTreeNode::splitNode ( )

Splits the data into two parts, creates two children and puts the split data into the children the aabb of this node does not change, the data of this node will be empty after this.

Member Data Documentation

SurgSim::Math::Aabbd SurgSim::DataStructures::AabbTreeNode::m_aabb
private

The internal bounding box for this node, it is used when the node does not have any data.

size_t SurgSim::DataStructures::AabbTreeNode::m_axis
private

Cache for the index of the longest axis on this node.


The documentation for this class was generated from the following files: