Public Types | Public Member Functions | Private Attributes | List of all members
SurgSim::DataStructures::AabbTree Class Reference

AabbTree is a tree that is organized by the bounding boxes of the referenced objects, the bounding box used is the Axis Aligned Bounding Box (AABB), with the extents of an AABB describing the min and max of each coordinate for the given object. More...

#include <SurgSim/DataStructures/AabbTree.h>

Inheritance diagram for SurgSim::DataStructures::AabbTree:
SurgSim::DataStructures::Tree

Public Types

typedef std::pair< std::shared_ptr< AabbTreeNode >, std::shared_ptr< AabbTreeNode > > TreeNodePairType
 Type indicating a relationship between two AabbTreeNodes. More...
 

Public Member Functions

 AabbTree ()
 Constructor. More...
 
 AabbTree (size_t maxObjectsPerNode)
 Constructor. More...
 
virtual ~AabbTree ()
 Destructor. More...
 
size_t getMaxObjectsPerNode () const
 
void add (const SurgSim::Math::Aabbd &aabb, size_t objectId)
 Add a give object identified by objectId to the tree, this id should be unqiue on the users side, but no checks are made in the inside of the tree. More...
 
const SurgSim::Math::AabbdgetAabb () const
 
std::list< TreeNodePairTypespatialJoin (const AabbTree &otherTree) const
 Query to find all pairs of intersecting nodes between two aabb r-trees. More...
 
void spatialJoin (std::shared_ptr< AabbTreeNode > lhsParent, std::shared_ptr< AabbTreeNode > rhsParent, std::list< TreeNodePairType > *result) const
 Query to find all pairs of intersecting nodes between two aabb r-trees. More...
 
- Public Member Functions inherited from SurgSim::DataStructures::Tree
 Tree ()
 Constructor. After construction, the root is null. More...
 
virtual ~Tree ()
 Destructor. More...
 
void setRoot (std::shared_ptr< TreeNode > root)
 Sets the root of the tree. More...
 
std::shared_ptr< TreeNodegetRoot () const
 
bool operator== (const Tree &tree) const
 If the trees are not of the same type, returns false; otherwise, compares with the implementation of isEqual(const Tree&). More...
 
bool operator!= (const Tree &tree) const
 If the trees are not of the same type, returns false; otherwise, compares with the implementation of isEqual(const Tree&). More...
 

Private Attributes

size_t m_maxObjectsPerNode
 Number of objects in a node that will trigger a split. More...
 
std::shared_ptr< AabbTreeNodem_typedRoot
 A typed version of the root for access without typecasting. More...
 

Additional Inherited Members

- Protected Member Functions inherited from SurgSim::DataStructures::Tree
virtual bool isEqual (const Tree &tree) const
 Recurses through the tree, starting at the root. More...
 

Detailed Description

AabbTree is a tree that is organized by the bounding boxes of the referenced objects, the bounding box used is the Axis Aligned Bounding Box (AABB), with the extents of an AABB describing the min and max of each coordinate for the given object.

Member Typedef Documentation

typedef std::pair<std::shared_ptr<AabbTreeNode>, std::shared_ptr<AabbTreeNode> > SurgSim::DataStructures::AabbTree::TreeNodePairType

Type indicating a relationship between two AabbTreeNodes.

Constructor & Destructor Documentation

SurgSim::DataStructures::AabbTree::AabbTree ( )

Constructor.

SurgSim::DataStructures::AabbTree::AabbTree ( size_t  maxObjectsPerNode)
explicit

Constructor.

Parameters
maxObjectsPerNodeif the number of objects exceeds this a split of the node will be triggered
SurgSim::DataStructures::AabbTree::~AabbTree ( )
virtual

Destructor.

Member Function Documentation

void SurgSim::DataStructures::AabbTree::add ( const SurgSim::Math::Aabbd aabb,
size_t  objectId 
)

Add a give object identified by objectId to the tree, this id should be unqiue on the users side, but no checks are made in the inside of the tree.

Parameters
aabbAABB of this object.
objectIdId for the object to be identified with this bounding box
const SurgSim::Math::Aabbd & SurgSim::DataStructures::AabbTree::getAabb ( ) const
size_t SurgSim::DataStructures::AabbTree::getMaxObjectsPerNode ( ) const
Returns
the number of objects per node that will trigger a split for this tree
std::list< AabbTree::TreeNodePairType > SurgSim::DataStructures::AabbTree::spatialJoin ( const AabbTree otherTree) const

Query to find all pairs of intersecting nodes between two aabb r-trees.

Parameters
otherTreeThe other tree to compare against return The list of all pairs of intersecting nodes
void SurgSim::DataStructures::AabbTree::spatialJoin ( std::shared_ptr< AabbTreeNode lhsParent,
std::shared_ptr< AabbTreeNode rhsParent,
std::list< TreeNodePairType > *  result 
) const

Query to find all pairs of intersecting nodes between two aabb r-trees.

Parameters
lhsParentroot node of the first tree
rhsParentroot node of the second tree
resultthe list of all pairs of intersecting nodes

Member Data Documentation

size_t SurgSim::DataStructures::AabbTree::m_maxObjectsPerNode
private

Number of objects in a node that will trigger a split.

std::shared_ptr<AabbTreeNode> SurgSim::DataStructures::AabbTree::m_typedRoot
private

A typed version of the root for access without typecasting.


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