Rasterfarm-SDK
Loading...
Searching...
No Matches
Tree::QuadTree Class Reference

#include <quadtree.h>

Classes

class  Branch
 
class  Leaf
 
class  Node
 

Public Member Functions

 QuadTree (const Vertex2fArray &vertex)
 
 QuadTree ()
 
 QuadTree (const QuadTree &)
 
virtual ~QuadTree ()
 
bool hasDuplicates ()
 
 operator const Branch & () const
 
 operator const Branch * () const
 
 operator HeapArray< Leaf * > ()
 
bool operator() (const Vertex2f &vA, const Vertex2f &vB) const
 
Leafnearest (const Vertex2f &vertex)
 
Leaffind (const Vertex2f &vertex, float precision=0.0f) const
 
void erase (Leaf *pLeaf)
 
Handle insert (const Vertex2f &vertex)
 
HeapArray< Handle > insert (const Vector2fArray &array)
 
template<typename INDICES >
Vector2fArray getVertices (const INDICES &c) const
 
Vector2fArray getVertices (bool unique=false) const
 
HeapArray< Leaf * > getLeaves () const
 
Leafoperator[] (Handle index) const
 
Handle operator[] (const Vertex2f &v) const
 
const Leafback () const
 
const Leaffront () const
 
HeapArray< Leaf * >::iterator begin ()
 
HeapArray< Leaf * >::iterator end ()
 
HeapArray< Leaf * >::const_iterator begin () const
 
HeapArray< Leaf * >::const_iterator end () const
 
size_t size () const
 
void clear ()
 
void update ()
 

Public Attributes

BranchpBase
 
HeapArray< Leaf * > pLeaf
 

Detailed Description

Implements and QuadTree node. No self-balancing is done.

Constructor & Destructor Documentation

◆ QuadTree() [1/3]

Tree::QuadTree::QuadTree ( const Vertex2fArray & vertex)

QuadTree with root branch bounding-box from vertex array; The center of the root branch will be that of the bounding-box of the vertex array.

Parameters
Anarray of vertices.

◆ QuadTree() [2/3]

Tree::QuadTree::QuadTree ( )

◆ QuadTree() [3/3]

Tree::QuadTree::QuadTree ( const QuadTree & )

◆ ~QuadTree()

virtual Tree::QuadTree::~QuadTree ( )
virtual

Member Function Documentation

◆ back()

const Leaf & Tree::QuadTree::back ( ) const
inline

◆ begin() [1/2]

HeapArray< Leaf * >::iterator Tree::QuadTree::begin ( )
inline

◆ begin() [2/2]

HeapArray< Leaf * >::const_iterator Tree::QuadTree::begin ( ) const
inline

◆ clear()

void Tree::QuadTree::clear ( )

◆ end() [1/2]

HeapArray< Leaf * >::iterator Tree::QuadTree::end ( )
inline

◆ end() [2/2]

HeapArray< Leaf * >::const_iterator Tree::QuadTree::end ( ) const
inline

◆ erase()

void Tree::QuadTree::erase ( Leaf * pLeaf)

Removes and deletes this leaf.

Parameters
Pointerof the leaf to remove;

◆ find()

Leaf * Tree::QuadTree::find ( const Vertex2f & vertex,
float precision = 0.0f ) const
Parameters
Vertexto search the tree for.
Theerror-limit for vertex comparison.
Returns
Null if not found, else a pointer to the Leaf.

◆ front()

const Leaf & Tree::QuadTree::front ( ) const
inline

◆ getLeaves()

HeapArray< Leaf * > Tree::QuadTree::getLeaves ( ) const

◆ getVertices() [1/2]

Vector2fArray Tree::QuadTree::getVertices ( bool unique = false) const

◆ getVertices() [2/2]

template<typename INDICES >
Vector2fArray Tree::QuadTree::getVertices ( const INDICES & c) const
inline
Returns
The container of vertices.

◆ hasDuplicates()

bool Tree::QuadTree::hasDuplicates ( )

◆ insert() [1/2]

HeapArray< Handle > Tree::QuadTree::insert ( const Vector2fArray & array)
Returns
An array of indices for the given Leaf pointers containing the vertices;

◆ insert() [2/2]

Handle Tree::QuadTree::insert ( const Vertex2f & vertex)
Returns
The index of the Leaf pointer containing the vertex;

◆ nearest()

Leaf * Tree::QuadTree::nearest ( const Vertex2f & vertex)
Parameters
Thevertex to search the tree.
Returns
The closest Leaf in the tree to the vertex passed.

◆ operator const Branch &()

Tree::QuadTree::operator const Branch & ( ) const
inline

◆ operator const Branch *()

Tree::QuadTree::operator const Branch * ( ) const
inline

◆ operator HeapArray< Leaf * >()

Tree::QuadTree::operator HeapArray< Leaf * > ( )
inline
Returns
An array of Leaf pointers inserted by iteration of the tree. NOTE: There are no duplicate Leaves.

◆ operator()()

bool Tree::QuadTree::operator() ( const Vertex2f & vA,
const Vertex2f & vB ) const

◆ operator[]() [1/2]

Handle Tree::QuadTree::operator[] ( const Vertex2f & v) const
Returns
The base index of the vertex within pLeaf.

◆ operator[]() [2/2]

Leaf & Tree::QuadTree::operator[] ( Handle index) const
Returns
Reference to the Vertex at the given index.

◆ size()

size_t Tree::QuadTree::size ( ) const
inline
Returns
The number of vertices stored in this tree. NOTE: The Array pLeaf may hold duplicate pointer references.

◆ update()

void Tree::QuadTree::update ( )

Removes all branches and leaves, and reinserts all leaves given new bounding-box center. NOTE: This may break any bounding-box associations to objects. Any pointers held to prior Nodes(Branches, Leaves) will become garbage.

Member Data Documentation

◆ pBase

Branch* Tree::QuadTree::pBase

The base or root

◆ pLeaf

HeapArray< Leaf * > Tree::QuadTree::pLeaf

This array preserves order of leaf insertion.


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