opensurgsim
Public Types | Public Member Functions | 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 <AabbTree.h>

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

Public Types

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

Public Member Functions

 AabbTree ()
 Constructor.
 
 AabbTree (size_t maxObjectsPerNode)
 Constructor. More...
 
virtual ~AabbTree ()
 Destructor.
 
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...
 
void set (const AabbTreeData::ItemList &items)
 Create the tree from a list of tree items, all the tree information will be deleted. More...
 
void set (AabbTreeData::ItemList &&items)
 Create the tree from a list of tree items, all the tree information will be deleted. More...
 
const SurgSim::Math::Aabbd & getAabb () const
 
std::vector< TreeNodePairTypespatialJoin (const AabbTree &otherTree) const
 Query to find all pairs of intersecting nodes between two aabb r-trees. More...
 
void spatialJoin (AabbTreeNode *lhsParent, AabbTreeNode *rhsParent, std::vector< TreeNodePairType > *result) const
 Query to find all pairs of intersecting nodes between two aabb r-trees. More...
 
void updateBounds (const std::vector< Math::Aabbd > &bounds)
 
void updateNodeBounds (const std::vector< Math::Aabbd > &bounds, SurgSim::DataStructures::AabbTreeNode *node)
 
- Public Member Functions inherited from SurgSim::DataStructures::Tree
 Tree ()
 Constructor. After construction, the root is null.
 
virtual ~Tree ()
 Destructor.
 
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...
 

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.

Constructor & Destructor Documentation

§ AabbTree()

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

Member Function Documentation

§ add()

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

§ getAabb()

const SurgSim::Math::Aabbd & SurgSim::DataStructures::AabbTree::getAabb ( ) const
Returns
the AABB for the tree

§ getMaxObjectsPerNode()

size_t SurgSim::DataStructures::AabbTree::getMaxObjectsPerNode ( ) const
Returns
the number of objects per node that will trigger a split for this tree

§ set() [1/2]

void SurgSim::DataStructures::AabbTree::set ( const AabbTreeData::ItemList &  items)

Create the tree from a list of tree items, all the tree information will be deleted.

Parameters
itemslist of items to insert into the tree

§ set() [2/2]

void SurgSim::DataStructures::AabbTree::set ( AabbTreeData::ItemList &&  items)

Create the tree from a list of tree items, all the tree information will be deleted.

Parameters
itemsrvalue reference to list of items to insert into the tree

§ spatialJoin() [1/2]

std::vector< 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
Returns
The list of all pairs of intersecting nodes

§ spatialJoin() [2/2]

void SurgSim::DataStructures::AabbTree::spatialJoin ( AabbTreeNode lhsParent,
AabbTreeNode rhsParent,
std::vector< 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

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