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:

## 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...
void | set (const std::list< AabbTreeData::Item > &items)
| Create the tree from a list of tree items, all the tree information will be deleted. More...
void | set (std::list< AabbTreeData::Item > &&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::list< TreeNodePairType > | spatialJoin (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< TreeNode > | getRoot () 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< AabbTreeNode > | m_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

## TreeNodePairType

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

## AabbTree() [1/2]

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

Constructor.

## AabbTree() [2/2]

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

explicit

Constructor.

Parameters

  maxObjectsPerNode | if the number of objects exceeds this a split of the node will be triggered

## ~AabbTree()

SurgSim::DataStructures::AabbTree::~AabbTree | ( |  | ) |

virtual

Destructor.

## 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

  aabb | AABB of this object.
  objectId | Id 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 std::list< AabbTreeData::Item > & | items | ) |

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

Parameters

  items | list of items to insert into the tree

## set() [2/2]

void SurgSim::DataStructures::AabbTree::set | ( | std::list< AabbTreeData::Item > && | items | ) |

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

Parameters

  items | rvalue reference to list of items to insert into the tree

## spatialJoin() [1/2]

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

  otherTree | The other tree to compare against

Returns
  The list of all pairs of intersecting nodes

## spatialJoin() [2/2]

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

  lhsParent | root node of the first tree
  rhsParent | root node of the second tree
  result | the list of all pairs of intersecting nodes

## Member Data Documentation

## m_maxObjectsPerNode

size_t SurgSim::DataStructures::AabbTree::m_maxObjectsPerNode

private

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

## m_typedRoot

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:

- SurgSim/DataStructures/AabbTree.h
- SurgSim/DataStructures/AabbTree.cpp