Public Member Functions | Friends | List of all members
AVO::Simulator Class Reference

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 Vector2getAgentPosition (std::size_t agentNo) const
 Returns the position of a specified agent. More...
 
const Vector2getAgentPrefVelocity (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 Vector2getAgentVelocity (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
 

Detailed Description

The simulation.

Member Function Documentation

◆ addAgent() [1/3]

std::size_t AVO::Simulator::addAgent ( const Vector2 position)

Adds a new agent with default properties to the simulation.

Parameters
[in]positionThe starting position of this agent.
Returns
The number of the agent.

◆ addAgent() [2/3]

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.

Parameters
[in]positionThe starting position of this agent.
[in]neighborDistThe maximum neighbor distance of this agent.
[in]maxNeighborsThe maximum neighbor count of this agent.
[in]timeHorizonThe time horizon of this agent.
[in]radiusThe radius of this agent.
[in]maxSpeedThe maximum speed of this agent.
[in]maxAccelThe maximum acceleration of this agent.
[in]accelIntervalThe acceleration interval of this agent.
Returns
The number of the agent.

◆ addAgent() [3/3]

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.

Parameters
[in]positionThe starting position of this agent.
[in]neighborDistThe maximum neighbor distance of this agent.
[in]maxNeighborsThe maximum neighbor count of this agent.
[in]timeHorizonThe time horizon of this agent.
[in]radiusThe radius of this agent.
[in]maxSpeedThe maximum speed of this agent.
[in]maxAccelThe maximum acceleration of this agent.
[in]accelIntervalThe acceleration interval of this agent.
[in]velocityThe initial velocity of this agent.
Returns
The number of the agent.

◆ getAgentAccelInterval()

float AVO::Simulator::getAgentAccelInterval ( std::size_t  agentNo) const

Returns the acceleration interval of a specified agent.

Parameters
[in]agentNoThe number of the agent whose acceleration interval is to be retrieved.
Returns
The present acceleration interval of the agent.

◆ getAgentMaxAccel()

float AVO::Simulator::getAgentMaxAccel ( std::size_t  agentNo) const

Returns the maximum acceleration of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum acceleration is to be retrieved.
Returns
The present maximum acceleration of the agent.

◆ getAgentMaxNeighbors()

std::size_t AVO::Simulator::getAgentMaxNeighbors ( std::size_t  agentNo) const

Returns the maximum neighbor count of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum neighbor count is to be retrieved.
Returns
The present maximum neighbor count of the agent.

◆ getAgentMaxSpeed()

float AVO::Simulator::getAgentMaxSpeed ( std::size_t  agentNo) const

Returns the maximum speed of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum speed is to be retrieved.
Returns
The present maximum speed of the agent.

◆ getAgentNeighbor()

std::size_t AVO::Simulator::getAgentNeighbor ( std::size_t  agentNo,
std::size_t  neighborNo 
) const

Returns the specified agent neighbor of the specified agent.

Parameters
[in]agentNoThe number of the agent whose agent neighbor is to be retrieved.
[in]neighborNoThe number of the agent neighbor to be retrieved.
Returns
The number of the neighboring agent.

◆ getAgentNeighborDist()

float AVO::Simulator::getAgentNeighborDist ( std::size_t  agentNo) const

Returns the maximum neighbor distance of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum neighbor distance is to be retrieved.
Returns
The present maximum neighbor distance of the agent.

◆ getAgentNumNeighbors()

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.

Parameters
[in]agentNoThe number of the agent whose count of agent neighbors is to be retrieved.
Returns
The count of agent neighbors taken into account to compute the current velocity for the specified agent.

◆ getAgentNumOrcaLines()

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.

Parameters
[in]agentNoThe number of the agent whose count of ORCA constraints is to be retrieved.
Returns
The count of ORCA constraints used to compute the current velocity for the specified agent.

◆ getAgentOrcaLine()

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.

Parameters
[in]agentNoThe number of the agent whose ORCA constraint is to be retrieved.
[in]lineNoThe number of the ORCA constraint to be retrieved.
Returns
A line representing the specified ORCA constraint.

◆ getAgentPosition()

const Vector2& AVO::Simulator::getAgentPosition ( std::size_t  agentNo) const

Returns the position of a specified agent.

Parameters
[in]agentNoThe number of the agent whose position is to be retrieved.
Returns
The present position of the (center of) the agent.

◆ getAgentPrefVelocity()

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.

Parameters
[in]agentNoThe number of the agent whose preferred velocity is to be retrieved.
Returns
The present preferred velocity of the agent.

◆ getAgentRadius()

float AVO::Simulator::getAgentRadius ( std::size_t  agentNo) const

Returns the radius of a specified agent.

Parameters
[in]agentNoThe number of the agent whose radius is to be retrieved.
Returns
The present radius of the agent.

◆ getAgentTimeHorizon()

float AVO::Simulator::getAgentTimeHorizon ( std::size_t  agentNo) const

Returns the time horizon of a specified agent.

Parameters
[in]agentNoThe number of the agent whose time horizon is to be retrieved.
Returns
The present time horizon of the agent.

◆ getAgentVelocity()

const Vector2& AVO::Simulator::getAgentVelocity ( std::size_t  agentNo) const

Returns the velocity of a specified agent.

Parameters
[in]agentNoThe number of the agent whose velocity is to be retrieved.
Returns
The present velocity of the agent.

◆ getGlobalTime()

float AVO::Simulator::getGlobalTime ( ) const
inline

Returns the global time of the simulation.

Returns
The present global time of the simulation (zero initially).

◆ getNumAgents()

std::size_t AVO::Simulator::getNumAgents ( ) const
inline

Returns the count of agents in the simulation.

Returns
The count of agents in the simulation.

◆ getTimeStep()

float AVO::Simulator::getTimeStep ( ) const
inline

Returns the time step of the simulation.

Returns
The present time step of the simulation.

◆ setAgentAccelInterval()

void AVO::Simulator::setAgentAccelInterval ( std::size_t  agentNo,
float  accelInterval 
)

Sets the acceleration interval of a specified agent.

Parameters
[in]agentNoThe number of the agent whose acceleration interval is to be modified.
[in]accelIntervalThe replacement acceleration interval.

◆ setAgentDefaults() [1/2]

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.

Parameters
[in]neighborDistThe default maximum neighbor distance of a new agent.
[in]maxNeighborsThe default maximum neighbor count of a new agent.
[in]timeHorizonThe time horizon of a new agent.
[in]radiusThe default radius of a new agent.
[in]maxSpeedThe default maximum speed of a new agent.
[in]maxAccelThe default maximum acceleration of a new agent.
[in]accelIntervalThe default acceleration interval of a new agent.

◆ setAgentDefaults() [2/2]

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.

Parameters
[in]neighborDistThe default maximum neighbor distance of a new agent.
[in]maxNeighborsThe default maximum neighbor count of a new agent.
[in]timeHorizonThe time horizon of a new agent.
[in]radiusThe default radius of a new agent.
[in]maxSpeedThe default maximum speed of a new agent.
[in]maxAccelThe default maximum acceleration of a new agent.
[in]accelIntervalThe default acceleration interval of a new agent.
[in]velocityThe default initial velocity of a new agent.

◆ setAgentMaxAccel()

void AVO::Simulator::setAgentMaxAccel ( std::size_t  agentNo,
float  maxAccel 
)

Sets the maximum acceleration of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum acceleration is to be modified.
[in]maxAccelThe replacement maximum acceleration.

◆ setAgentMaxNeighbors()

void AVO::Simulator::setAgentMaxNeighbors ( std::size_t  agentNo,
std::size_t  maxNeighbors 
)

Sets the maximum neighbor count of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum neighbor count is to be modified.
[in]maxNeighborsThe replacement maximum neighbor count.

◆ setAgentMaxSpeed()

void AVO::Simulator::setAgentMaxSpeed ( std::size_t  agentNo,
float  maxSpeed 
)

Sets the maximum speed of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum speed is to be modified.
[in]maxSpeedThe replacement maximum speed.

◆ setAgentNeighborDist()

void AVO::Simulator::setAgentNeighborDist ( std::size_t  agentNo,
float  neighborDist 
)

Sets the maximum neighbor distance of a specified agent.

Parameters
[in]agentNoThe number of the agent whose maximum neighbor distance is to be modified.
[in]neighborDistThe replacement maximum neighbor distance.

◆ setAgentPosition()

void AVO::Simulator::setAgentPosition ( std::size_t  agentNo,
const Vector2 position 
)

Sets the position of a specified agent.

Parameters
[in]agentNoThe number of the agent whose position is to be modified.
[in]positionThe replacement position.

◆ setAgentPrefVelocity()

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.

Parameters
[in]agentNoThe number of the agent whose preferred velocity is to be modified.
[in]prefVelocityThe replacement preferred velocity.

◆ setAgentRadius()

void AVO::Simulator::setAgentRadius ( std::size_t  agentNo,
float  radius 
)

Sets the radius of a specified agent.

Parameters
[in]agentNoThe number of the agent whose radius is to be modified.
[in]radiusThe replacement radius.

◆ setAgentTimeHorizon()

void AVO::Simulator::setAgentTimeHorizon ( std::size_t  agentNo,
float  timeHorizon 
)

Sets the time horizon of a specified agent.

Parameters
[in]agentNoThe number of the agent whose time horizon is to be modified.
[in]timeHorizonThe replacement time horizon.

◆ setAgentVelocity()

void AVO::Simulator::setAgentVelocity ( std::size_t  agentNo,
const Vector2 velocity 
)

Sets the velocity of a specified agent.

Parameters
[in]agentNoThe number of the agent whose velocity is to be modified.
[in]velocityThe replacement velocity.

◆ setGlobalTime()

void AVO::Simulator::setGlobalTime ( float  globalTime)
inline

Sets the global time of the simulation.

Parameters
[in]globalTimeThe replacement global time of the simulation.

◆ setTimeStep()

void AVO::Simulator::setTimeStep ( float  timeStep)
inline

Sets the time step of the simulation.

Parameters
[in]timeStepThe replacement time step of the simulation.

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