DUNE: Uniform Navigational Environment  2019.02.1
Simulators::Environment::QuadTree Class Reference

Detailed Description

"Quad-tree" structure used to index spatial data in two dimensions.

Classes

struct  Item
 
class  Iteration
 

Public Member Functions

 QuadTree (const Bounds &bounds)
 
 ~QuadTree ()
 
bool insert (const Item &item)
 
void iterate (Iteration &iteration) const
 
void iterate (Iteration &iteration, const Bounds &area) const
 
void clear (void)
 
void remove (const Bounds &area)
 
bool search (const Bounds &area, std::vector< Item > &items) const
 
uint32_t size (const Bounds &area) const
 

Constructor & Destructor Documentation

Simulators::Environment::QuadTree::QuadTree ( const Bounds bounds)
Simulators::Environment::QuadTree::~QuadTree ( )

Member Function Documentation

void Simulators::Environment::QuadTree::clear ( void  )
bool Simulators::Environment::QuadTree::insert ( const Item item)

Insert an item.

Returns 'false' if item is out-of-bounds.

References Simulators::Environment::Bounds::contains(), and Simulators::Environment::Node::insert().

Referenced by Simulators::Environment::QuadTree::Iteration::~Iteration().

void Simulators::Environment::QuadTree::iterate ( Iteration iteration) const
void Simulators::Environment::QuadTree::iterate ( Iteration iteration,
const Bounds area 
) const

Iterate tree over a given area.

References Simulators::Environment::Node::iterate().

void Simulators::Environment::QuadTree::remove ( const Bounds area)

Remove items in a given area.

References clear(), and Simulators::Environment::Node::remove().

bool Simulators::Environment::QuadTree::search ( const Bounds area,
std::vector< Item > &  items 
) const

Search for items in a given area.

If any are found returns 'true' and adds results to 'item' vector.

Referenced by Simulators::Environment::Task::depthAt(), and Simulators::Environment::QuadTree::Iteration::~Iteration().

uint32_t Simulators::Environment::QuadTree::size ( const Bounds area) const

Get number of elements in a given area.

References iterate().

Referenced by Simulators::Environment::QuadTree::Iteration::~Iteration().

Collaboration diagram for Simulators::Environment::QuadTree:
Collaboration graph