Menge
Modular Pedestrian Simulation Framework for Research and Development
|
Defines an obstacle kd-tree. More...
#include <ObstacleKDTree.h>
Public Member Functions | |
ObstacleKDTree () | |
Constructs an Obstacle kd-tree instance. | |
~ObstacleKDTree () | |
Destroys this kd-tree instance. | |
void | buildTree (const std::vector< Obstacle * > obstacles) |
Builds an obstacle kd-tree on the given set of obstacles. | |
void | obstacleQuery (ProximityQuery *query) const |
Computes the obstacles within range square of a point. More... | |
bool | queryVisibility (const Vector2 &q1, const Vector2 &q2, float radius) const |
Queries the visibility between two points within a specified radius. More... | |
Protected Member Functions | |
ObstacleTreeNode * | buildTreeRecursive (const std::vector< Obstacle * > &obstacles) |
Does the full work of constructing the kd-tree. More... | |
void | queryTreeRecursive (ProximityQuery *query, Vector2 pt, float &rangeSq, const ObstacleTreeNode *node) const |
Computes the obstacle neighbors of the specified point by doing a recursive search. More... | |
bool | queryVisibilityRecursive (const Vector2 &q1, const Vector2 &q2, float radius, const ObstacleTreeNode *node) const |
Perform the work, recursively, to determine if q1 can see q2, w.r.t. the obstacles. More... | |
void | deleteTree () |
Recursively deletes the obstacle tree. | |
void | deleteSubTree (ObstacleTreeNode *node) |
Recursively deletes an obstacle sub-tree. More... | |
Protected Attributes | |
std::vector< Obstacle * > | _obstacles |
The set of obstacles managed by this query structure. More... | |
ObstacleTreeNode * | _tree |
The query tree root. | |
Static Protected Attributes | |
static const size_t | MAX_LEAF_SIZE = 10 |
The maximum number of obstacles allowed in a tree leaf node. | |
Defines an obstacle kd-tree.
This structure will create a static kd-tree node on the provided set of obstacles. It will modify the obstacles in that some obstacles may be cut.
|
protected |
Does the full work of constructing the kd-tree.
obstacles | The set of obstacles to construct this tree around |
|
protected |
Recursively deletes an obstacle sub-tree.
node | The root of the tree to delete. |
void Menge::Agents::ObstacleKDTree::obstacleQuery | ( | ProximityQuery * | query | ) | const |
Computes the obstacles within range square of a point.
query | a pointer for the query to be performed |
|
protected |
Computes the obstacle neighbors of the specified point by doing a recursive search.
query | a pointer to the query being performed. |
pt | the starting point from the query |
rangeSq | The squared range around the agent. |
node | The current node in the obstacle tree |
bool Menge::Agents::ObstacleKDTree::queryVisibility | ( | const Vector2 & | q1, |
const Vector2 & | q2, | ||
float | radius | ||
) | const |
Queries the visibility between two points within a specified radius.
q1 | The first point between which visibility is to be tested. |
q2 | The second point between which visibility is to be tested. |
radius | The radius within which visibility is to be tested. |
|
protected |
Perform the work, recursively, to determine if q1 can see q2, w.r.t. the obstacles.
q1 | The originating position. |
q2 | The target position. |
radius | The radius within which visibility is to be tested. |
node | The root of the tree to recursively search. |
|
protected |
The set of obstacles managed by this query structure.
This is not necessarily the same as the obstacles assigned. The set of obstacles can change as some obstacles may be sub-divided during the spatial decomposition. This needs to be corrected.