Classes | Public Member Functions | Properties | List of all members
RVO.Simulator Class Reference

Defines the simulation. More...

Collaboration diagram for RVO.Simulator:
[legend]

Public Member Functions

int addAgent (Vector2 position)
 Adds a new agent with default properties to the simulation. More...
 
int addAgent (Vector2 position, float neighborDist, int maxNeighbors, float timeHorizon, float timeHorizonObst, float radius, float maxSpeed, Vector2 velocity)
 Adds a new agent to the simulation. More...
 
int addObstacle (IList< Vector2 > vertices)
 Adds a new obstacle to the simulation. More...
 
void Clear ()
 Clears the simulation. More...
 
float doStep ()
 Performs a simulation step and updates the two-dimensional position and two-dimensional velocity of each agent. More...
 
int getAgentAgentNeighbor (int agentNo, int neighborNo)
 Returns the specified agent neighbor of the specified agent. More...
 
int getAgentMaxNeighbors (int agentNo)
 Returns the maximum neighbor count of a specified agent. More...
 
float getAgentMaxSpeed (int agentNo)
 Returns the maximum speed of a specified agent. More...
 
float getAgentNeighborDist (int agentNo)
 Returns the maximum neighbor distance of a specified agent. More...
 
int getAgentNumAgentNeighbors (int agentNo)
 Returns the count of agent neighbors taken into account to compute the current velocity for the specified agent. More...
 
int getAgentNumObstacleNeighbors (int agentNo)
 Returns the count of obstacle neighbors taken into account to compute the current velocity for the specified agent. More...
 
int getAgentObstacleNeighbor (int agentNo, int neighborNo)
 Returns the specified obstacle neighbor of the specified agent. More...
 
IList< LinegetAgentOrcaLines (int agentNo)
 Returns the ORCA constraints of the specified agent. More...
 
Vector2 getAgentPosition (int agentNo)
 Returns the two-dimensional position of a specified agent. More...
 
Vector2 getAgentPrefVelocity (int agentNo)
 Returns the two-dimensional preferred velocity of a specified agent. More...
 
float getAgentRadius (int agentNo)
 Returns the radius of a specified agent. More...
 
float getAgentTimeHorizon (int agentNo)
 Returns the time horizon of a specified agent. More...
 
float getAgentTimeHorizonObst (int agentNo)
 Returns the time horizon with respect to obstacles of a specified agent. More...
 
Vector2 getAgentVelocity (int agentNo)
 Returns the two-dimensional linear velocity of a specified agent. More...
 
float getGlobalTime ()
 Returns the global time of the simulation. More...
 
int getNumAgents ()
 Returns the count of agents in the simulation. More...
 
int getNumObstacleVertices ()
 Returns the count of obstacle vertices in the simulation. More...
 
int GetNumWorkers ()
 Returns the count of workers. More...
 
Vector2 getObstacleVertex (int vertexNo)
 Returns the two-dimensional position of a specified obstacle vertex. More...
 
int getNextObstacleVertexNo (int vertexNo)
 Returns the number of the obstacle vertex succeeding the specified obstacle vertex in its polygon. More...
 
int getPrevObstacleVertexNo (int vertexNo)
 Returns the number of the obstacle vertex preceding the specified obstacle vertex in its polygon. More...
 
float getTimeStep ()
 Returns the time step of the simulation. More...
 
void processObstacles ()
 Processes the obstacles that have been added so that they are accounted for in the simulation. More...
 
bool queryVisibility (Vector2 point1, Vector2 point2, float radius)
 Performs a visibility query between the two specified points with respect to the obstacles. More...
 
void setAgentDefaults (float neighborDist, int maxNeighbors, float timeHorizon, float timeHorizonObst, float radius, float maxSpeed, Vector2 velocity)
 Sets the default properties for any new agent that is added. More...
 
void setAgentMaxNeighbors (int agentNo, int maxNeighbors)
 Sets the maximum neighbor count of a specified agent. More...
 
void setAgentMaxSpeed (int agentNo, float maxSpeed)
 Sets the maximum speed of a specified agent. More...
 
void setAgentNeighborDist (int agentNo, float neighborDist)
 Sets the maximum neighbor distance of a specified agent. More...
 
void setAgentPosition (int agentNo, Vector2 position)
 Sets the two-dimensional position of a specified agent. More...
 
void setAgentPrefVelocity (int agentNo, Vector2 prefVelocity)
 Sets the two-dimensional preferred velocity of a specified agent. More...
 
void setAgentRadius (int agentNo, float radius)
 Sets the radius of a specified agent. More...
 
void setAgentTimeHorizon (int agentNo, float timeHorizon)
 Sets the time horizon of a specified agent with respect to other agents. More...
 
void setAgentTimeHorizonObst (int agentNo, float timeHorizonObst)
 Sets the time horizon of a specified agent with respect to obstacles. More...
 
void setAgentVelocity (int agentNo, Vector2 velocity)
 Sets the two-dimensional linear velocity of a specified agent. More...
 
void setGlobalTime (float globalTime)
 Sets the global time of the simulation. More...
 
void SetNumWorkers (int numWorkers)
 Sets the number of workers. More...
 
void setTimeStep (float timeStep)
 Sets the time step of the simulation. More...
 

Properties

static Simulator Instance [get]
 

Detailed Description

Defines the simulation.

Member Function Documentation

◆ addAgent() [1/2]

int RVO.Simulator.addAgent ( Vector2  position)
inline

Adds a new agent with default properties to the simulation.

Returns
The number of the agent, or -1 when the agent defaults have not been set.
Parameters
positionThe two-dimensional starting position of this agent.

◆ addAgent() [2/2]

int RVO.Simulator.addAgent ( Vector2  position,
float  neighborDist,
int  maxNeighbors,
float  timeHorizon,
float  timeHorizonObst,
float  radius,
float  maxSpeed,
Vector2  velocity 
)
inline

Adds a new agent to the simulation.

Returns
The number of the agent.
Parameters
positionThe two-dimensional starting position of this agent.
neighborDistThe maximum distance (center point to center point) to other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe. Must be non-negative.
maxNeighborsThe maximum number of other agents this agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
timeHorizonThe minimal amount of time for which this agent's velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner this agent will respond to the presence of other agents, but the less freedom this agent has in choosing its velocities. Must be positive.
timeHorizonObstThe minimal amount of time for which this agent's velocities that are computed by the simulation are safe with respect to obstacles. The larger this number, the sooner this agent will respond to the presence of obstacles, but the less freedom this agent has in choosing its velocities. Must be positive.
radiusThe radius of this agent. Must be non-negative.
maxSpeedThe maximum speed of this agent. Must be non-negative.
velocityThe initial two-dimensional linear velocity of this agent.

◆ addObstacle()

int RVO.Simulator.addObstacle ( IList< Vector2 vertices)
inline

Adds a new obstacle to the simulation.

Returns
The number of the first vertex of the obstacle, or -1 when the number of vertices is less than two.
Parameters
verticesList of the vertices of the polygonal obstacle in counterclockwise order.

To add a "negative" obstacle, e.g. a bounding polygon around the environment, the vertices should be listed in clockwise order.

◆ Clear()

void RVO.Simulator.Clear ( )
inline

Clears the simulation.

◆ doStep()

float RVO.Simulator.doStep ( )
inline

Performs a simulation step and updates the two-dimensional position and two-dimensional velocity of each agent.

Returns
The global time after the simulation step.

◆ getAgentAgentNeighbor()

int RVO.Simulator.getAgentAgentNeighbor ( int  agentNo,
int  neighborNo 
)
inline

Returns the specified agent neighbor of the specified agent.

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

◆ getAgentMaxNeighbors()

int RVO.Simulator.getAgentMaxNeighbors ( int  agentNo)
inline

Returns the maximum neighbor count of a specified agent.

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

◆ getAgentMaxSpeed()

float RVO.Simulator.getAgentMaxSpeed ( int  agentNo)
inline

Returns the maximum speed of a specified agent.

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

◆ getAgentNeighborDist()

float RVO.Simulator.getAgentNeighborDist ( int  agentNo)
inline

Returns the maximum neighbor distance of a specified agent.

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

◆ getAgentNumAgentNeighbors()

int RVO.Simulator.getAgentNumAgentNeighbors ( int  agentNo)
inline

Returns the count of agent neighbors taken into account to compute the current velocity for the specified agent.

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

◆ getAgentNumObstacleNeighbors()

int RVO.Simulator.getAgentNumObstacleNeighbors ( int  agentNo)
inline

Returns the count of obstacle neighbors taken into account to compute the current velocity for the specified agent.

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

◆ getAgentObstacleNeighbor()

int RVO.Simulator.getAgentObstacleNeighbor ( int  agentNo,
int  neighborNo 
)
inline

Returns the specified obstacle neighbor of the specified agent.

Returns
The number of the first vertex of the neighboring obstacle edge.
Parameters
agentNoThe number of the agent whose obstacle neighbor is to be retrieved.
neighborNoThe number of the obstacle neighbor to be retrieved.

◆ getAgentOrcaLines()

IList<Line> RVO.Simulator.getAgentOrcaLines ( int  agentNo)
inline

Returns the ORCA constraints of the specified agent.

Returns
A list of lines representing the ORCA constraints.
Parameters
agentNoThe number of the agent whose ORCA constraints are to be retrieved.

The halfplane to the left of each line is the region of permissible velocities with respect to that ORCA constraint.

◆ getAgentPosition()

Vector2 RVO.Simulator.getAgentPosition ( int  agentNo)
inline

Returns the two-dimensional position of a specified agent.

Returns
The present two-dimensional position of the (center of the) agent.
Parameters
agentNoThe number of the agent whose two-dimensional position is to be retrieved.

◆ getAgentPrefVelocity()

Vector2 RVO.Simulator.getAgentPrefVelocity ( int  agentNo)
inline

Returns the two-dimensional preferred velocity of a specified agent.

Returns
The present two-dimensional preferred velocity of the agent.
Parameters
agentNoThe number of the agent whose two-dimensional preferred velocity is to be retrieved.

◆ getAgentRadius()

float RVO.Simulator.getAgentRadius ( int  agentNo)
inline

Returns the radius of a specified agent.

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

◆ getAgentTimeHorizon()

float RVO.Simulator.getAgentTimeHorizon ( int  agentNo)
inline

Returns the time horizon of a specified agent.

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

◆ getAgentTimeHorizonObst()

float RVO.Simulator.getAgentTimeHorizonObst ( int  agentNo)
inline

Returns the time horizon with respect to obstacles of a specified agent.

Returns
The present time horizon with respect to obstacles of the agent.
Parameters
agentNoThe number of the agent whose time horizon with respect to obstacles is to be retrieved.

◆ getAgentVelocity()

Vector2 RVO.Simulator.getAgentVelocity ( int  agentNo)
inline

Returns the two-dimensional linear velocity of a specified agent.

Returns
The present two-dimensional linear velocity of the agent.
Parameters
agentNoThe number of the agent whose two-dimensional linear velocity is to be retrieved.

◆ getGlobalTime()

float RVO.Simulator.getGlobalTime ( )
inline

Returns the global time of the simulation.

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

◆ getNextObstacleVertexNo()

int RVO.Simulator.getNextObstacleVertexNo ( int  vertexNo)
inline

Returns the number of the obstacle vertex succeeding the specified obstacle vertex in its polygon.

Returns
The number of the obstacle vertex succeeding the specified obstacle vertex in its polygon.
Parameters
vertexNoThe number of the obstacle vertex whose successor is to be retrieved.

◆ getNumAgents()

int RVO.Simulator.getNumAgents ( )
inline

Returns the count of agents in the simulation.

Returns
The count of agents in the simulation.

◆ getNumObstacleVertices()

int RVO.Simulator.getNumObstacleVertices ( )
inline

Returns the count of obstacle vertices in the simulation.

Returns
The count of obstacle vertices in the simulation.

◆ GetNumWorkers()

int RVO.Simulator.GetNumWorkers ( )
inline

Returns the count of workers.

Returns
The count of workers.

◆ getObstacleVertex()

Vector2 RVO.Simulator.getObstacleVertex ( int  vertexNo)
inline

Returns the two-dimensional position of a specified obstacle vertex.

Returns
The two-dimensional position of the specified obstacle vertex.
Parameters
vertexNoThe number of the obstacle vertex to be retrieved.

◆ getPrevObstacleVertexNo()

int RVO.Simulator.getPrevObstacleVertexNo ( int  vertexNo)
inline

Returns the number of the obstacle vertex preceding the specified obstacle vertex in its polygon.

Returns
The number of the obstacle vertex preceding the specified obstacle vertex in its polygon.
Parameters
vertexNoThe number of the obstacle vertex whose predecessor is to be retrieved.

◆ getTimeStep()

float RVO.Simulator.getTimeStep ( )
inline

Returns the time step of the simulation.

Returns
The present time step of the simulation.

◆ processObstacles()

void RVO.Simulator.processObstacles ( )
inline

Processes the obstacles that have been added so that they are accounted for in the simulation.

Obstacles added to the simulation after this function has been called are not accounted for in the simulation.

◆ queryVisibility()

bool RVO.Simulator.queryVisibility ( Vector2  point1,
Vector2  point2,
float  radius 
)
inline

Performs a visibility query between the two specified points with respect to the obstacles.

Returns
A boolean specifying whether the two points are mutually visible. Returns true when the obstacles have not been processed.
Parameters
point1The first point of the query.
point2The second point of the query.
radiusThe minimal distance between the line connecting the two points and the obstacles in order for the points to be mutually visible (optional). Must be non-negative.

◆ setAgentDefaults()

void RVO.Simulator.setAgentDefaults ( float  neighborDist,
int  maxNeighbors,
float  timeHorizon,
float  timeHorizonObst,
float  radius,
float  maxSpeed,
Vector2  velocity 
)
inline

Sets the default properties for any new agent that is added.

Parameters
neighborDistThe default maximum distance (center point to center point) to other agents a new agent takes into account in the navigation. The larger this number, the longer he running time of the simulation. If the number is too low, the simulation will not be safe. Must be non-negative.
maxNeighborsThe default maximum number of other agents a new agent takes into account in the navigation. The larger this number, the longer the running time of the simulation. If the number is too low, the simulation will not be safe.
timeHorizonThe default minimal amount of time for which a new agent's velocities that are computed by the simulation are safe with respect to other agents. The larger this number, the sooner an agent will respond to the presence of other agents, but the less freedom the agent has in choosing its velocities. Must be positive.
timeHorizonObstThe default minimal amount of time for which a new agent's velocities that are computed by the simulation are safe with respect to obstacles. The larger this number, the sooner an agent will respond to the presence of obstacles, but the less freedom the agent has in choosing its velocities. Must be positive.
radiusThe default radius of a new agent. Must be non-negative.
maxSpeedThe default maximum speed of a new agent. Must be non-negative.
velocityThe default initial two-dimensional linear velocity of a new agent.

◆ setAgentMaxNeighbors()

void RVO.Simulator.setAgentMaxNeighbors ( int  agentNo,
int  maxNeighbors 
)
inline

Sets the maximum neighbor count of a specified agent.

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

◆ setAgentMaxSpeed()

void RVO.Simulator.setAgentMaxSpeed ( int  agentNo,
float  maxSpeed 
)
inline

Sets the maximum speed of a specified agent.

Parameters
agentNoThe number of the agent whose maximum speed is to be modified.
maxSpeedThe replacement maximum speed. Must be non-negative.

◆ setAgentNeighborDist()

void RVO.Simulator.setAgentNeighborDist ( int  agentNo,
float  neighborDist 
)
inline

Sets the maximum neighbor distance of a specified agent.

Parameters
agentNoThe number of the agent whose maximum neighbor distance is to be modified.
neighborDistThe replacement maximum neighbor distance. Must be non-negative.

◆ setAgentPosition()

void RVO.Simulator.setAgentPosition ( int  agentNo,
Vector2  position 
)
inline

Sets the two-dimensional position of a specified agent.

Parameters
agentNoThe number of the agent whose two-dimensional position is to be modified.
positionThe replacement of the two-dimensional position.

◆ setAgentPrefVelocity()

void RVO.Simulator.setAgentPrefVelocity ( int  agentNo,
Vector2  prefVelocity 
)
inline

Sets the two-dimensional preferred velocity of a specified agent.

Parameters
agentNoThe number of the agent whose two-dimensional preferred velocity is to be modified.
prefVelocityThe replacement of the two-dimensional preferred velocity.

◆ setAgentRadius()

void RVO.Simulator.setAgentRadius ( int  agentNo,
float  radius 
)
inline

Sets the radius of a specified agent.

Parameters
agentNoThe number of the agent whose radius is to be modified.
radiusThe replacement radius. Must be non-negative.

◆ setAgentTimeHorizon()

void RVO.Simulator.setAgentTimeHorizon ( int  agentNo,
float  timeHorizon 
)
inline

Sets the time horizon of a specified agent with respect to other agents.

Parameters
agentNoThe number of the agent whose time horizon is to be modified.
timeHorizonThe replacement time horizon with respect to other agents. Must be positive.

◆ setAgentTimeHorizonObst()

void RVO.Simulator.setAgentTimeHorizonObst ( int  agentNo,
float  timeHorizonObst 
)
inline

Sets the time horizon of a specified agent with respect to obstacles.

Parameters
agentNoThe number of the agent whose time horizon with respect to obstacles is to be modified.
timeHorizonObstThe replacement time horizon with respect to obstacles. Must be positive.

◆ setAgentVelocity()

void RVO.Simulator.setAgentVelocity ( int  agentNo,
Vector2  velocity 
)
inline

Sets the two-dimensional linear velocity of a specified agent.

Parameters
agentNoThe number of the agent whose two-dimensional linear velocity is to be modified.
velocityThe replacement two-dimensional linear velocity.

◆ setGlobalTime()

void RVO.Simulator.setGlobalTime ( float  globalTime)
inline

Sets the global time of the simulation.

Parameters
globalTimeThe global time of the simulation.

◆ SetNumWorkers()

void RVO.Simulator.SetNumWorkers ( int  numWorkers)
inline

Sets the number of workers.

Parameters
numWorkersThe number of workers.

◆ setTimeStep()

void RVO.Simulator.setTimeStep ( float  timeStep)
inline

Sets the time step of the simulation.

Parameters
timeStepThe time step of the simulation. Must be positive.

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