Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Menge::Agents::KNearestQuery Class Reference

The K-Nearest query class. More...

#include <KNearestQuery.h>

Inheritance diagram for Menge::Agents::KNearestQuery:
Menge::Agents::ProximityQuery

Public Member Functions

 KNearestQuery ()
 default Constructor.
 
void filterAgent (const BaseAgent *agent, float distSq)
 filters an agent and determines if it is within the set of k-nearest neighbors More...
 
void filterObstacle (const Obstacle *obstacle, float distSq)
 filters an obstacle and determines if it is within the set of k-nearest neighbors More...
 
void setMaxAgentResults (size_t results)
 sets the max number of agent results for this query to store More...
 
void setMaxObstacleResults (size_t results)
 sets the max number of obstacle results for this query to store More...
 
void setQueryPoint (Vector2 point)
 sets the query point More...
 
void setQueryRangeSq (float range)
 sets the query point More...
 
size_t maxAgentResults ()
 gets the max number of agent results for this query to store More...
 
size_t maxObstacleResults ()
 gets the max number of obstacle results for this query to store More...
 
size_t agentResultCount ()
 gets the number of agent results stored currently More...
 
size_t obstacleResultCount ()
 gets the number of obstacle results stored currently More...
 
void startQuery ()
 clears the result vectors. Resets the query
 
virtual Vector2 getQueryPoint ()
 gets the start point for the query More...
 
NearAgent getAgentResult (size_t i)
 gets the ith agent result More...
 
NearObstacle getObstacleResult (size_t i)
 gets the ith obstacle result More...
 
virtual float getMaxAgentRange ()
 updates the max agent query range if conditions inside the query are met typically, we don't shrink the query range until the result set is full More...
 
virtual float getMaxObstacleRange ()
 updates the max query obstacle range if conditions inside the query are met typically, we don't shrink the query range until the result set is full More...
 
- Public Member Functions inherited from Menge::Agents::ProximityQuery
 ProximityQuery ()
 default Constructor.
 

Protected Attributes

size_t _maxAgentResults
 the max number of agent results to store
 
size_t _maxObstacleResults
 the max number of obstacle results to store
 
float _maxAgentResultDistance
 the max distance to an agent result. Useful for informing the spatial query to stop searching further
 
float _maxObstacleResultDistance
 the max distance to an obstacle result. Useful for informing the spatial query to stop searching further
 
std::vector< NearAgent_agentResults
 vector of pairs. Each pair contains a distance to an agent, and the agent
 
std::vector< NearObstacle_obstacleResults
 vector of pairs. Each pair contains a distance to an obstacle, and the obstacle
 
Vector2 _queryPoint
 the start point for the query
 
float _initialRange
 the base max range of queries
 

Additional Inherited Members

- Protected Member Functions inherited from Menge::Agents::ProximityQuery
virtual ~ProximityQuery ()
 Virtual destructor.
 

Detailed Description

The K-Nearest query class.

A spatial query which returns the k nearest agents and obstacles in the spatial query The query doesn't know where the point it, it is given distances in this case, K is set to the maxAgentResults and maxObstacleResults

Member Function Documentation

size_t Menge::Agents::KNearestQuery::agentResultCount ( )
inline

gets the number of agent results stored currently

Returns
the number of agent results in the query
void Menge::Agents::KNearestQuery::filterAgent ( const BaseAgent agent,
float  distSq 
)
virtual

filters an agent and determines if it is within the set of k-nearest neighbors

Parameters
agentthe agent to consider
distSqthe distance to the agent

Implements Menge::Agents::ProximityQuery.

void Menge::Agents::KNearestQuery::filterObstacle ( const Obstacle obstacle,
float  distSq 
)
virtual

filters an obstacle and determines if it is within the set of k-nearest neighbors

Parameters
obstaclethe obstacle to consider
distSqthe distance to the obstacle

Implements Menge::Agents::ProximityQuery.

NearAgent Menge::Agents::KNearestQuery::getAgentResult ( size_t  i)
inline

gets the ith agent result

Parameters
ithe index of the agent to get
Returns
the result pair in question
float Menge::Agents::KNearestQuery::getMaxAgentRange ( )
virtual

updates the max agent query range if conditions inside the query are met typically, we don't shrink the query range until the result set is full

Returns
the new query distance. Typically this is the initial value.d

Implements Menge::Agents::ProximityQuery.

virtual float Menge::Agents::KNearestQuery::getMaxObstacleRange ( )
inlinevirtual

updates the max query obstacle range if conditions inside the query are met typically, we don't shrink the query range until the result set is full

Returns
the new query distance. Typically this is the initial value.

Implements Menge::Agents::ProximityQuery.

NearObstacle Menge::Agents::KNearestQuery::getObstacleResult ( size_t  i)
inline

gets the ith obstacle result

Parameters
ithe index of the obstacle to get
Returns
the result pair in question
virtual Vector2 Menge::Agents::KNearestQuery::getQueryPoint ( )
inlinevirtual

gets the start point for the query

Returns
the query point for this query

Implements Menge::Agents::ProximityQuery.

size_t Menge::Agents::KNearestQuery::maxAgentResults ( )
inline

gets the max number of agent results for this query to store

Returns
the number of agent results to store
size_t Menge::Agents::KNearestQuery::maxObstacleResults ( )
inline

gets the max number of obstacle results for this query to store

Returns
the number of obstacle results to store
size_t Menge::Agents::KNearestQuery::obstacleResultCount ( )
inline

gets the number of obstacle results stored currently

Returns
the number of obstacle results in the query
void Menge::Agents::KNearestQuery::setMaxAgentResults ( size_t  results)
inline

sets the max number of agent results for this query to store

Parameters
resultsthe number of agent results to store
void Menge::Agents::KNearestQuery::setMaxObstacleResults ( size_t  results)
inline

sets the max number of obstacle results for this query to store

Parameters
resultsthe number of obstacle results to store
void Menge::Agents::KNearestQuery::setQueryPoint ( Vector2  point)
inline

sets the query point

Parameters
pointthe query point to be stored
void Menge::Agents::KNearestQuery::setQueryRangeSq ( float  range)
inline

sets the query point

Parameters
rangethe squared range to search for nearby candidates

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