Public Member Functions | Friends | List of all members
RVO::RVOSimulator Class Reference

Defines the simulation. More...

#include <RVOSimulator.h>

Public Member Functions

RVO_API RVOSimulator ()
 Constructs a simulator instance.
 
RVO_API RVOSimulator (float timeStep, float neighborDist, size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, const Vector3 &velocity=Vector3())
 Constructs a simulator instance and sets the default properties for any new agent that is added. More...
 
RVO_API ~RVOSimulator ()
 Destroys this simulator instance.
 
RVO_API size_t addAgent (const Vector3 &position)
 Adds a new agent with default properties to the simulation. More...
 
RVO_API size_t addAgent (const Vector3 &position, float neighborDist, size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, const Vector3 &velocity=Vector3())
 Adds a new agent to the simulation. More...
 
RVO_API void doStep ()
 Lets the simulator perform a simulation step and updates the three-dimensional position and three-dimensional velocity of each agent.
 
RVO_API size_t getAgentAgentNeighbor (size_t agentNo, size_t neighborNo) const
 Returns the specified agent neighbor of the specified agent. More...
 
RVO_API size_t getAgentMaxNeighbors (size_t agentNo) const
 Returns the maximum neighbor count of a specified agent. More...
 
RVO_API float getAgentMaxSpeed (size_t agentNo) const
 Returns the maximum speed of a specified agent. More...
 
RVO_API float getAgentNeighborDist (size_t agentNo) const
 Returns the maximum neighbor distance of a specified agent. More...
 
RVO_API size_t getAgentNumAgentNeighbors (size_t agentNo) const
 Returns the count of agent neighbors taken into account to compute the current velocity for the specified agent. More...
 
RVO_API size_t getAgentNumORCAPlanes (size_t agentNo) const
 Returns the count of ORCA constraints used to compute the current velocity for the specified agent. More...
 
RVO_API const PlanegetAgentORCAPlane (size_t agentNo, size_t planeNo) const
 Returns the specified ORCA constraint of the specified agent. More...
 
RVO_API const Vector3getAgentPosition (size_t agentNo) const
 Returns the three-dimensional position of a specified agent. More...
 
RVO_API const Vector3getAgentPrefVelocity (size_t agentNo) const
 Returns the three-dimensional preferred velocity of a specified agent. More...
 
RVO_API float getAgentRadius (size_t agentNo) const
 Returns the radius of a specified agent. More...
 
RVO_API float getAgentTimeHorizon (size_t agentNo) const
 Returns the time horizon of a specified agent. More...
 
RVO_API const Vector3getAgentVelocity (size_t agentNo) const
 Returns the three-dimensional linear velocity of a specified agent. More...
 
RVO_API float getGlobalTime () const
 Returns the global time of the simulation. More...
 
RVO_API size_t getNumAgents () const
 Returns the count of agents in the simulation. More...
 
RVO_API float getTimeStep () const
 Returns the time step of the simulation. More...
 
RVO_API void removeAgent (size_t agentNo)
 Removes an agent from the simulation. More...
 
RVO_API void setAgentDefaults (float neighborDist, size_t maxNeighbors, float timeHorizon, float radius, float maxSpeed, const Vector3 &velocity=Vector3())
 Sets the default properties for any new agent that is added. More...
 
RVO_API void setAgentMaxNeighbors (size_t agentNo, size_t maxNeighbors)
 Sets the maximum neighbor count of a specified agent. More...
 
RVO_API void setAgentMaxSpeed (size_t agentNo, float maxSpeed)
 Sets the maximum speed of a specified agent. More...
 
RVO_API void setAgentNeighborDist (size_t agentNo, float neighborDist)
 Sets the maximum neighbor distance of a specified agent. More...
 
RVO_API void setAgentPosition (size_t agentNo, const Vector3 &position)
 Sets the three-dimensional position of a specified agent. More...
 
RVO_API void setAgentPrefVelocity (size_t agentNo, const Vector3 &prefVelocity)
 Sets the three-dimensional preferred velocity of a specified agent. More...
 
RVO_API void setAgentRadius (size_t agentNo, float radius)
 Sets the radius of a specified agent. More...
 
RVO_API void setAgentTimeHorizon (size_t agentNo, float timeHorizon)
 Sets the time horizon of a specified agent with respect to other agents. More...
 
RVO_API void setAgentVelocity (size_t agentNo, const Vector3 &velocity)
 Sets the three-dimensional linear velocity of a specified agent. More...
 
RVO_API void setTimeStep (float timeStep)
 Sets the time step of the simulation. More...
 

Friends

class Agent
 
class KdTree
 

Detailed Description

Defines the simulation.

The main class of the library that contains all simulation functionality.

Constructor & Destructor Documentation

◆ RVOSimulator()

RVO_API RVO::RVOSimulator::RVOSimulator ( float  timeStep,
float  neighborDist,
size_t  maxNeighbors,
float  timeHorizon,
float  radius,
float  maxSpeed,
const Vector3 velocity = Vector3() 
)

Constructs a simulator instance and sets the default properties for any new agent that is added.

Parameters
timeStepThe time step of the simulation. Must be positive.
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 minimum 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.
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 three-dimensional linear velocity of a new agent (optional).

Member Function Documentation

◆ addAgent() [1/2]

RVO_API size_t RVO::RVOSimulator::addAgent ( const Vector3 position)

Adds a new agent with default properties to the simulation.

Parameters
positionThe three-dimensional starting position of this agent.
Returns
The number of the agent, or RVO::RVO_ERROR when the agent defaults have not been set.

◆ addAgent() [2/2]

RVO_API size_t RVO::RVOSimulator::addAgent ( const Vector3 position,
float  neighborDist,
size_t  maxNeighbors,
float  timeHorizon,
float  radius,
float  maxSpeed,
const Vector3 velocity = Vector3() 
)

Adds a new agent to the simulation.

Parameters
positionThe three-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 minimum 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.
radiusThe radius of this agent. Must be non-negative.
maxSpeedThe maximum speed of this agent. Must be non-negative.
velocityThe initial three-dimensional linear velocity of this agent (optional).
Returns
The number of the agent.

◆ getAgentAgentNeighbor()

RVO_API size_t RVO::RVOSimulator::getAgentAgentNeighbor ( size_t  agentNo,
size_t  neighborNo 
) const

Returns the specified agent neighbor of the specified agent.

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

◆ getAgentMaxNeighbors()

RVO_API size_t RVO::RVOSimulator::getAgentMaxNeighbors ( size_t  agentNo) const

Returns the maximum neighbor count of a specified agent.

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

◆ getAgentMaxSpeed()

RVO_API float RVO::RVOSimulator::getAgentMaxSpeed ( size_t  agentNo) const

Returns the maximum speed of a specified agent.

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

◆ getAgentNeighborDist()

RVO_API float RVO::RVOSimulator::getAgentNeighborDist ( size_t  agentNo) const

Returns the maximum neighbor distance of a specified agent.

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

◆ getAgentNumAgentNeighbors()

RVO_API size_t RVO::RVOSimulator::getAgentNumAgentNeighbors ( size_t  agentNo) const

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.
Returns
The count of agent neighbors taken into account to compute the current velocity for the specified agent.

◆ getAgentNumORCAPlanes()

RVO_API size_t RVO::RVOSimulator::getAgentNumORCAPlanes ( size_t  agentNo) const

Returns the count of ORCA constraints used to compute the current velocity for the specified agent.

Parameters
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.

◆ getAgentORCAPlane()

RVO_API const Plane& RVO::RVOSimulator::getAgentORCAPlane ( size_t  agentNo,
size_t  planeNo 
) const

Returns the specified ORCA constraint of the specified agent.

Parameters
agentNoThe number of the agent whose ORCA constraint is to be retrieved.
planeNoThe number of the ORCA constraint to be retrieved.
Returns
A plane representing the specified ORCA constraint.
Note
The halfspace to which the normal of the plane points is the region of permissible velocities with respect to the specified ORCA constraint.

◆ getAgentPosition()

RVO_API const Vector3& RVO::RVOSimulator::getAgentPosition ( size_t  agentNo) const

Returns the three-dimensional position of a specified agent.

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

◆ getAgentPrefVelocity()

RVO_API const Vector3& RVO::RVOSimulator::getAgentPrefVelocity ( size_t  agentNo) const

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

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

◆ getAgentRadius()

RVO_API float RVO::RVOSimulator::getAgentRadius ( size_t  agentNo) const

Returns the radius of a specified agent.

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

◆ getAgentTimeHorizon()

RVO_API float RVO::RVOSimulator::getAgentTimeHorizon ( size_t  agentNo) const

Returns the time horizon of a specified agent.

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

◆ getAgentVelocity()

RVO_API const Vector3& RVO::RVOSimulator::getAgentVelocity ( size_t  agentNo) const

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

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

◆ getGlobalTime()

RVO_API float RVO::RVOSimulator::getGlobalTime ( ) const

Returns the global time of the simulation.

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

◆ getNumAgents()

RVO_API size_t RVO::RVOSimulator::getNumAgents ( ) const

Returns the count of agents in the simulation.

Returns
The count of agents in the simulation.

◆ getTimeStep()

RVO_API float RVO::RVOSimulator::getTimeStep ( ) const

Returns the time step of the simulation.

Returns
The present time step of the simulation.

◆ removeAgent()

RVO_API void RVO::RVOSimulator::removeAgent ( size_t  agentNo)

Removes an agent from the simulation.

Parameters
agentNoThe number of the agent that is to be removed.
Note
After the removal of the agent, the agent that previously had number getNumAgents() - 1 will now have number agentNo.

◆ setAgentDefaults()

RVO_API void RVO::RVOSimulator::setAgentDefaults ( float  neighborDist,
size_t  maxNeighbors,
float  timeHorizon,
float  radius,
float  maxSpeed,
const Vector3 velocity = Vector3() 
)

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 minimum 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.
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 three-dimensional linear velocity of a new agent (optional).

◆ setAgentMaxNeighbors()

RVO_API void RVO::RVOSimulator::setAgentMaxNeighbors ( size_t  agentNo,
size_t  maxNeighbors 
)

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()

RVO_API void RVO::RVOSimulator::setAgentMaxSpeed ( size_t  agentNo,
float  maxSpeed 
)

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()

RVO_API void RVO::RVOSimulator::setAgentNeighborDist ( size_t  agentNo,
float  neighborDist 
)

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()

RVO_API void RVO::RVOSimulator::setAgentPosition ( size_t  agentNo,
const Vector3 position 
)

Sets the three-dimensional position of a specified agent.

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

◆ setAgentPrefVelocity()

RVO_API void RVO::RVOSimulator::setAgentPrefVelocity ( size_t  agentNo,
const Vector3 prefVelocity 
)

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

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

◆ setAgentRadius()

RVO_API void RVO::RVOSimulator::setAgentRadius ( size_t  agentNo,
float  radius 
)

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()

RVO_API void RVO::RVOSimulator::setAgentTimeHorizon ( size_t  agentNo,
float  timeHorizon 
)

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.

◆ setAgentVelocity()

RVO_API void RVO::RVOSimulator::setAgentVelocity ( size_t  agentNo,
const Vector3 velocity 
)

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

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

◆ setTimeStep()

RVO_API void RVO::RVOSimulator::setTimeStep ( float  timeStep)

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: