The simulation. More...
#include <Simulator.h>
Public Member Functions | |
Simulator () | |
Constructor. | |
~Simulator () | |
Destructor. | |
std::size_t | addAgent (const Vector2 &position) |
Adds a new agent with default properties to the simulation. More... | |
std::size_t | addAgent (const Vector2 &position, float neighborDist, std::size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, float maxAccel, float accelInterval) |
Adds a new agent to the simulation. More... | |
std::size_t | addAgent (const Vector2 &position, float neighborDist, std::size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, float maxAccel, float accelInterval, const Vector2 &velocity) |
Adds a new agent to the simulation. More... | |
void | doStep () |
Performs a simulation step and updates the position and velocity of each agent. | |
float | getAgentAccelInterval (std::size_t agentNo) const |
Returns the acceleration interval of a specified agent. More... | |
std::size_t | getAgentNeighbor (std::size_t agentNo, std::size_t neighborNo) const |
Returns the specified agent neighbor of the specified agent. More... | |
float | getAgentMaxAccel (std::size_t agentNo) const |
Returns the maximum acceleration of a specified agent. More... | |
std::size_t | getAgentMaxNeighbors (std::size_t agentNo) const |
Returns the maximum neighbor count of a specified agent. More... | |
float | getAgentMaxSpeed (std::size_t agentNo) const |
Returns the maximum speed of a specified agent. More... | |
float | getAgentNeighborDist (std::size_t agentNo) const |
Returns the maximum neighbor distance of a specified agent. More... | |
std::size_t | getAgentNumNeighbors (std::size_t agentNo) const |
Returns the count of agent neighbors taken into account to compute the current velocity for the specified agent. More... | |
std::size_t | getAgentNumOrcaLines (std::size_t agentNo) const |
Returns the count of ORCA constraints used to compute the current velocity for the specified agent. More... | |
const Line & | getAgentOrcaLine (std::size_t agentNo, std::size_t lineNo) const |
Returns the specified ORCA constraint of the specified agent. More... | |
const Vector2 & | getAgentPosition (std::size_t agentNo) const |
Returns the position of a specified agent. More... | |
const Vector2 & | getAgentPrefVelocity (std::size_t agentNo) const |
Returns the preferred velocity of a specified agent. More... | |
float | getAgentRadius (std::size_t agentNo) const |
Returns the radius of a specified agent. More... | |
float | getAgentTimeHorizon (std::size_t agentNo) const |
Returns the time horizon of a specified agent. More... | |
const Vector2 & | getAgentVelocity (std::size_t agentNo) const |
Returns the velocity of a specified agent. More... | |
float | getGlobalTime () const |
Returns the global time of the simulation. More... | |
std::size_t | getNumAgents () const |
Returns the count of agents in the simulation. More... | |
float | getTimeStep () const |
Returns the time step of the simulation. More... | |
void | setAgentAccelInterval (std::size_t agentNo, float accelInterval) |
Sets the acceleration interval of a specified agent. More... | |
void | setAgentDefaults (float neighborDist, std::size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, float maxAccel, float accelInterval) |
Sets the default properties for any new agent that is added. More... | |
void | setAgentDefaults (float neighborDist, std::size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, float maxAccel, float accelInterval, const Vector2 &velocity) |
Sets the default properties for any new agent that is added. More... | |
void | setAgentMaxAccel (std::size_t agentNo, float maxAccel) |
Sets the maximum acceleration of a specified agent. More... | |
void | setAgentMaxNeighbors (std::size_t agentNo, std::size_t maxNeighbors) |
Sets the maximum neighbor count of a specified agent. More... | |
void | setAgentMaxSpeed (std::size_t agentNo, float maxSpeed) |
Sets the maximum speed of a specified agent. More... | |
void | setAgentNeighborDist (std::size_t agentNo, float neighborDist) |
Sets the maximum neighbor distance of a specified agent. More... | |
void | setAgentPosition (std::size_t agentNo, const Vector2 &position) |
Sets the position of a specified agent. More... | |
void | setAgentPrefVelocity (std::size_t agentNo, const Vector2 &prefVelocity) |
Sets the preferred velocity of a specified agent. More... | |
void | setAgentRadius (std::size_t agentNo, float radius) |
Sets the radius of a specified agent. More... | |
void | setAgentTimeHorizon (std::size_t agentNo, float timeHorizon) |
Sets the time horizon of a specified agent. More... | |
void | setAgentVelocity (std::size_t agentNo, const Vector2 &velocity) |
Sets the velocity of a specified agent. More... | |
void | setGlobalTime (float globalTime) |
Sets the global time of the simulation. More... | |
void | setTimeStep (float timeStep) |
Sets the time step of the simulation. More... | |
Friends | |
class | KdTree |
The simulation.
std::size_t AVO::Simulator::addAgent | ( | const Vector2 & | position | ) |
Adds a new agent with default properties to the simulation.
[in] | position | The starting position of this agent. |
std::size_t AVO::Simulator::addAgent | ( | const Vector2 & | position, |
float | neighborDist, | ||
std::size_t | maxNeighbors, | ||
float | timeHorizon, | ||
float | radius, | ||
float | maxSpeed, | ||
float | maxAccel, | ||
float | accelInterval | ||
) |
Adds a new agent to the simulation.
[in] | position | The starting position of this agent. |
[in] | neighborDist | The maximum neighbor distance of this agent. |
[in] | maxNeighbors | The maximum neighbor count of this agent. |
[in] | timeHorizon | The time horizon of this agent. |
[in] | radius | The radius of this agent. |
[in] | maxSpeed | The maximum speed of this agent. |
[in] | maxAccel | The maximum acceleration of this agent. |
[in] | accelInterval | The acceleration interval of this agent. |
std::size_t AVO::Simulator::addAgent | ( | const Vector2 & | position, |
float | neighborDist, | ||
std::size_t | maxNeighbors, | ||
float | timeHorizon, | ||
float | radius, | ||
float | maxSpeed, | ||
float | maxAccel, | ||
float | accelInterval, | ||
const Vector2 & | velocity | ||
) |
Adds a new agent to the simulation.
[in] | position | The starting position of this agent. |
[in] | neighborDist | The maximum neighbor distance of this agent. |
[in] | maxNeighbors | The maximum neighbor count of this agent. |
[in] | timeHorizon | The time horizon of this agent. |
[in] | radius | The radius of this agent. |
[in] | maxSpeed | The maximum speed of this agent. |
[in] | maxAccel | The maximum acceleration of this agent. |
[in] | accelInterval | The acceleration interval of this agent. |
[in] | velocity | The initial velocity of this agent. |
float AVO::Simulator::getAgentAccelInterval | ( | std::size_t | agentNo | ) | const |
Returns the acceleration interval of a specified agent.
[in] | agentNo | The number of the agent whose acceleration interval is to be retrieved. |
float AVO::Simulator::getAgentMaxAccel | ( | std::size_t | agentNo | ) | const |
Returns the maximum acceleration of a specified agent.
[in] | agentNo | The number of the agent whose maximum acceleration is to be retrieved. |
std::size_t AVO::Simulator::getAgentMaxNeighbors | ( | std::size_t | agentNo | ) | const |
Returns the maximum neighbor count of a specified agent.
[in] | agentNo | The number of the agent whose maximum neighbor count is to be retrieved. |
float AVO::Simulator::getAgentMaxSpeed | ( | std::size_t | agentNo | ) | const |
Returns the maximum speed of a specified agent.
[in] | agentNo | The number of the agent whose maximum speed is to be retrieved. |
std::size_t AVO::Simulator::getAgentNeighbor | ( | std::size_t | agentNo, |
std::size_t | neighborNo | ||
) | const |
Returns the specified agent neighbor of the specified agent.
[in] | agentNo | The number of the agent whose agent neighbor is to be retrieved. |
[in] | neighborNo | The number of the agent neighbor to be retrieved. |
float AVO::Simulator::getAgentNeighborDist | ( | std::size_t | agentNo | ) | const |
Returns the maximum neighbor distance of a specified agent.
[in] | agentNo | The number of the agent whose maximum neighbor distance is to be retrieved. |
std::size_t AVO::Simulator::getAgentNumNeighbors | ( | std::size_t | agentNo | ) | const |
Returns the count of agent neighbors taken into account to compute the current velocity for the specified agent.
[in] | agentNo | The number of the agent whose count of agent neighbors is to be retrieved. |
std::size_t AVO::Simulator::getAgentNumOrcaLines | ( | std::size_t | agentNo | ) | const |
Returns the count of ORCA constraints used to compute the current velocity for the specified agent.
[in] | agentNo | The number of the agent whose count of ORCA constraints is to be retrieved. |
const Line& AVO::Simulator::getAgentOrcaLine | ( | std::size_t | agentNo, |
std::size_t | lineNo | ||
) | const |
Returns the specified ORCA constraint of the specified agent.
The halfplane to the left of the line is the region of permissible velocities with respect to the specified ORCA constraint.
[in] | agentNo | The number of the agent whose ORCA constraint is to be retrieved. |
[in] | lineNo | The number of the ORCA constraint to be retrieved. |
const Vector2& AVO::Simulator::getAgentPosition | ( | std::size_t | agentNo | ) | const |
Returns the position of a specified agent.
[in] | agentNo | The number of the agent whose position is to be retrieved. |
const Vector2& AVO::Simulator::getAgentPrefVelocity | ( | std::size_t | agentNo | ) | const |
Returns the preferred velocity of a specified agent.
The preferred velocity of an agent is the velocity it would choose to take if it were not influenced by other agents.
[in] | agentNo | The number of the agent whose preferred velocity is to be retrieved. |
float AVO::Simulator::getAgentRadius | ( | std::size_t | agentNo | ) | const |
Returns the radius of a specified agent.
[in] | agentNo | The number of the agent whose radius is to be retrieved. |
float AVO::Simulator::getAgentTimeHorizon | ( | std::size_t | agentNo | ) | const |
Returns the time horizon of a specified agent.
[in] | agentNo | The number of the agent whose time horizon is to be retrieved. |
const Vector2& AVO::Simulator::getAgentVelocity | ( | std::size_t | agentNo | ) | const |
Returns the velocity of a specified agent.
[in] | agentNo | The number of the agent whose velocity is to be retrieved. |
|
inline |
Returns the global time of the simulation.
|
inline |
Returns the count of agents in the simulation.
|
inline |
Returns the time step of the simulation.
void AVO::Simulator::setAgentAccelInterval | ( | std::size_t | agentNo, |
float | accelInterval | ||
) |
Sets the acceleration interval of a specified agent.
[in] | agentNo | The number of the agent whose acceleration interval is to be modified. |
[in] | accelInterval | The replacement acceleration interval. |
void AVO::Simulator::setAgentDefaults | ( | float | neighborDist, |
std::size_t | maxNeighbors, | ||
float | timeHorizon, | ||
float | radius, | ||
float | maxSpeed, | ||
float | maxAccel, | ||
float | accelInterval | ||
) |
Sets the default properties for any new agent that is added.
[in] | neighborDist | The default maximum neighbor distance of a new agent. |
[in] | maxNeighbors | The default maximum neighbor count of a new agent. |
[in] | timeHorizon | The time horizon of a new agent. |
[in] | radius | The default radius of a new agent. |
[in] | maxSpeed | The default maximum speed of a new agent. |
[in] | maxAccel | The default maximum acceleration of a new agent. |
[in] | accelInterval | The default acceleration interval of a new agent. |
void AVO::Simulator::setAgentDefaults | ( | float | neighborDist, |
std::size_t | maxNeighbors, | ||
float | timeHorizon, | ||
float | radius, | ||
float | maxSpeed, | ||
float | maxAccel, | ||
float | accelInterval, | ||
const Vector2 & | velocity | ||
) |
Sets the default properties for any new agent that is added.
[in] | neighborDist | The default maximum neighbor distance of a new agent. |
[in] | maxNeighbors | The default maximum neighbor count of a new agent. |
[in] | timeHorizon | The time horizon of a new agent. |
[in] | radius | The default radius of a new agent. |
[in] | maxSpeed | The default maximum speed of a new agent. |
[in] | maxAccel | The default maximum acceleration of a new agent. |
[in] | accelInterval | The default acceleration interval of a new agent. |
[in] | velocity | The default initial velocity of a new agent. |
void AVO::Simulator::setAgentMaxAccel | ( | std::size_t | agentNo, |
float | maxAccel | ||
) |
Sets the maximum acceleration of a specified agent.
[in] | agentNo | The number of the agent whose maximum acceleration is to be modified. |
[in] | maxAccel | The replacement maximum acceleration. |
void AVO::Simulator::setAgentMaxNeighbors | ( | std::size_t | agentNo, |
std::size_t | maxNeighbors | ||
) |
Sets the maximum neighbor count of a specified agent.
[in] | agentNo | The number of the agent whose maximum neighbor count is to be modified. |
[in] | maxNeighbors | The replacement maximum neighbor count. |
void AVO::Simulator::setAgentMaxSpeed | ( | std::size_t | agentNo, |
float | maxSpeed | ||
) |
Sets the maximum speed of a specified agent.
[in] | agentNo | The number of the agent whose maximum speed is to be modified. |
[in] | maxSpeed | The replacement maximum speed. |
void AVO::Simulator::setAgentNeighborDist | ( | std::size_t | agentNo, |
float | neighborDist | ||
) |
Sets the maximum neighbor distance of a specified agent.
[in] | agentNo | The number of the agent whose maximum neighbor distance is to be modified. |
[in] | neighborDist | The replacement maximum neighbor distance. |
void AVO::Simulator::setAgentPosition | ( | std::size_t | agentNo, |
const Vector2 & | position | ||
) |
Sets the position of a specified agent.
[in] | agentNo | The number of the agent whose position is to be modified. |
[in] | position | The replacement position. |
void AVO::Simulator::setAgentPrefVelocity | ( | std::size_t | agentNo, |
const Vector2 & | prefVelocity | ||
) |
Sets the preferred velocity of a specified agent.
The preferred velocity of an agent is the velocity it would choose to take if it were not influenced by other agents.
[in] | agentNo | The number of the agent whose preferred velocity is to be modified. |
[in] | prefVelocity | The replacement preferred velocity. |
void AVO::Simulator::setAgentRadius | ( | std::size_t | agentNo, |
float | radius | ||
) |
Sets the radius of a specified agent.
[in] | agentNo | The number of the agent whose radius is to be modified. |
[in] | radius | The replacement radius. |
void AVO::Simulator::setAgentTimeHorizon | ( | std::size_t | agentNo, |
float | timeHorizon | ||
) |
Sets the time horizon of a specified agent.
[in] | agentNo | The number of the agent whose time horizon is to be modified. |
[in] | timeHorizon | The replacement time horizon. |
void AVO::Simulator::setAgentVelocity | ( | std::size_t | agentNo, |
const Vector2 & | velocity | ||
) |
Sets the velocity of a specified agent.
[in] | agentNo | The number of the agent whose velocity is to be modified. |
[in] | velocity | The replacement velocity. |
|
inline |
Sets the global time of the simulation.
[in] | globalTime | The replacement global time of the simulation. |
|
inline |
Sets the time step of the simulation.
[in] | timeStep | The replacement time step of the simulation. |