O --- O
libPEDSIM Documentation
[HOME] [EXAMPLES] [ECOSYSTEM] [DOCUMENTATION] [DOWNLOAD]
O --- O
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
Ped::Ttree Class Reference

Public Member Functions

 Ttree (Ped::Tscene *scene, int depth, double x, double y, double w, double h)
 
virtual ~Ttree ()
 
virtual void clear ()
 
virtual void addAgent (const Ped::Tagent *a)
 
virtual void moveAgent (const Ped::Tagent *a)
 
virtual bool removeAgent (const Ped::Tagent *a)
 
virtual set< const Ped::Tagent * > getAgents () const
 
virtual void getAgents (list< const Ped::Tagent * > &outputList) const
 
virtual bool intersects (double px, double py, double pr) const
 
double getx () const
 
double gety () const
 
double getw () const
 
double geth () const
 
double getdepth () const
 

Protected Member Functions

virtual int cut ()
 
virtual void addChildren ()
 
TtreegetChildByPosition (double x, double y)
 

Protected Attributes

bool isleaf
 
double x
 
double y
 
double w
 
double h
 
int depth
 
Ttreetree1
 
Ttreetree2
 
Ttreetree3
 
Ttreetree4
 
Ped::Tscenescene
 

Friends

class Tscene
 

Detailed Description

Definition at line 39 of file ped_tree.h.

Constructor & Destructor Documentation

Ped::Ttree::Ttree ( Ped::Tscene pscene,
int  pdepth,
double  px,
double  py,
double  pw,
double  ph 
)

Description: set intial values

Author
chgloor
Date
2012-01-28

Definition at line 19 of file ped_tree.cpp.

Ped::Ttree::~Ttree ( )
virtual

Destructor. Deleted this node and all its children. If there are any agents left, they are removed first (not deleted).

Author
chgloor
Date
2012-01-28

Definition at line 37 of file ped_tree.cpp.

Member Function Documentation

void Ped::Ttree::addAgent ( const Ped::Tagent a)
virtual

Adds an agent to the tree. Searches the right node and adds the agent there. If there are too many agents at that node allready, a new child is created.

Author
chgloor
Date
2012-01-28
Parameters
*aThe agent to add

Definition at line 65 of file ped_tree.cpp.

void Ped::Ttree::addChildren ( )
protectedvirtual

A little helper that adds child nodes to this node

Author
chgloor
Date
2012-01-28

Definition at line 97 of file ped_tree.cpp.

int Ped::Ttree::cut ( )
protectedvirtual

Checks if this tree node has not enough agents in it to justify more child nodes. It does this by checking all child nodes, too, recursively. If there are not enough children, it moves all the agents into this node, and deletes the child nodes.

Author
chgloor
Date
2012-01-28
Returns
the number of agents in this and all child nodes.

Definition at line 151 of file ped_tree.cpp.

set< const Ped::Tagent * > Ped::Ttree::getAgents ( ) const
virtual

Returns the set of agents that is stored within this tree node

Author
chgloor
Date
2012-01-28
Returns
The set of agents

Definition at line 188 of file ped_tree.cpp.

bool Ped::Ttree::intersects ( double  px,
double  py,
double  pr 
) const
virtual

Checks if a point x/y is within the space handled by the tree node, or within a given radius r

Author
chgloor
Date
2012-01-29
Returns
true if the point is within the space
Parameters
pxThe x co-ordinate of the point
pyThe y co-ordinate of the point
prThe radius

Definition at line 226 of file ped_tree.cpp.

void Ped::Ttree::moveAgent ( const Ped::Tagent a)
virtual

Updates the tree structure if an agent moves. Removes the agent and places it again, if outside boundary. If an this happens, this is O(log n), but O(1) otherwise.

Author
chgloor
Date
2012-01-28
Parameters
*athe agent to update

Definition at line 125 of file ped_tree.cpp.


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

⁠(c) Christian Gloor [ c|h|g|l|o|o|r|@|s|i|l|m|a|r|i|l|.|o|r|g| ]