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 Plane & | getAgentORCAPlane (size_t agentNo, size_t planeNo) const |
Returns the specified ORCA constraint of the specified agent. More... | |
RVO_API const Vector3 & | getAgentPosition (size_t agentNo) const |
Returns the three-dimensional position of a specified agent. More... | |
RVO_API const Vector3 & | getAgentPrefVelocity (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 Vector3 & | getAgentVelocity (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 |
Defines the simulation.
The main class of the library that contains all simulation functionality.
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.
timeStep | The time step of the simulation. Must be positive. |
neighborDist | The 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. |
maxNeighbors | The 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. |
timeHorizon | The 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. |
radius | The default radius of a new agent. Must be non-negative. |
maxSpeed | The default maximum speed of a new agent. Must be non-negative. |
velocity | The default initial three-dimensional linear velocity of a new agent (optional). |
RVO_API size_t RVO::RVOSimulator::addAgent | ( | const Vector3 & | position | ) |
Adds a new agent with default properties to the simulation.
position | The three-dimensional starting position of this agent. |
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.
position | The three-dimensional starting position of this agent. |
neighborDist | The 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. |
maxNeighbors | The 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. |
timeHorizon | The 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. |
radius | The radius of this agent. Must be non-negative. |
maxSpeed | The maximum speed of this agent. Must be non-negative. |
velocity | The initial three-dimensional linear velocity of this agent (optional). |
RVO_API size_t RVO::RVOSimulator::getAgentAgentNeighbor | ( | size_t | agentNo, |
size_t | neighborNo | ||
) | const |
Returns the specified agent neighbor of the specified agent.
agentNo | The number of the agent whose agent neighbor is to be retrieved. |
neighborNo | The number of the agent neighbor to be retrieved. |
RVO_API size_t RVO::RVOSimulator::getAgentMaxNeighbors | ( | size_t | agentNo | ) | const |
Returns the maximum neighbor count of a specified agent.
agentNo | The number of the agent whose maximum neighbor count is to be retrieved. |
RVO_API float RVO::RVOSimulator::getAgentMaxSpeed | ( | size_t | agentNo | ) | const |
Returns the maximum speed of a specified agent.
agentNo | The number of the agent whose maximum speed is to be retrieved. |
RVO_API float RVO::RVOSimulator::getAgentNeighborDist | ( | size_t | agentNo | ) | const |
Returns the maximum neighbor distance of a specified agent.
agentNo | The number of the agent whose maximum neighbor distance is to be retrieved. |
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.
agentNo | The number of the agent whose count of agent neighbors is to be retrieved. |
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.
agentNo | The number of the agent whose count of ORCA constraints is to be retrieved. |
RVO_API const Plane& RVO::RVOSimulator::getAgentORCAPlane | ( | size_t | agentNo, |
size_t | planeNo | ||
) | const |
Returns the specified ORCA constraint of the specified agent.
agentNo | The number of the agent whose ORCA constraint is to be retrieved. |
planeNo | The number of the ORCA constraint to be retrieved. |
RVO_API const Vector3& RVO::RVOSimulator::getAgentPosition | ( | size_t | agentNo | ) | const |
Returns the three-dimensional position of a specified agent.
agentNo | The number of the agent whose three-dimensional position is to be retrieved. |
RVO_API const Vector3& RVO::RVOSimulator::getAgentPrefVelocity | ( | size_t | agentNo | ) | const |
Returns the three-dimensional preferred velocity of a specified agent.
agentNo | The number of the agent whose three-dimensional preferred velocity is to be retrieved. |
RVO_API float RVO::RVOSimulator::getAgentRadius | ( | size_t | agentNo | ) | const |
Returns the radius of a specified agent.
agentNo | The number of the agent whose radius is to be retrieved. |
RVO_API float RVO::RVOSimulator::getAgentTimeHorizon | ( | size_t | agentNo | ) | const |
Returns the time horizon of a specified agent.
agentNo | The number of the agent whose time horizon is to be retrieved. |
RVO_API const Vector3& RVO::RVOSimulator::getAgentVelocity | ( | size_t | agentNo | ) | const |
Returns the three-dimensional linear velocity of a specified agent.
agentNo | The number of the agent whose three-dimensional linear velocity is to be retrieved. |
RVO_API float RVO::RVOSimulator::getGlobalTime | ( | ) | const |
Returns the global time of the simulation.
RVO_API size_t RVO::RVOSimulator::getNumAgents | ( | ) | const |
Returns the count of agents in the simulation.
RVO_API float RVO::RVOSimulator::getTimeStep | ( | ) | const |
Returns the time step of the simulation.
RVO_API void RVO::RVOSimulator::removeAgent | ( | size_t | agentNo | ) |
Removes an agent from the simulation.
agentNo | The number of the agent that is to be removed. |
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.
neighborDist | The 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. |
maxNeighbors | The 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. |
timeHorizon | The 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. |
radius | The default radius of a new agent. Must be non-negative. |
maxSpeed | The default maximum speed of a new agent. Must be non-negative. |
velocity | The default initial three-dimensional linear velocity of a new agent (optional). |
RVO_API void RVO::RVOSimulator::setAgentMaxNeighbors | ( | size_t | agentNo, |
size_t | maxNeighbors | ||
) |
Sets the maximum neighbor count of a specified agent.
agentNo | The number of the agent whose maximum neighbor count is to be modified. |
maxNeighbors | The replacement maximum neighbor count. |
RVO_API void RVO::RVOSimulator::setAgentMaxSpeed | ( | size_t | agentNo, |
float | maxSpeed | ||
) |
Sets the maximum speed of a specified agent.
agentNo | The number of the agent whose maximum speed is to be modified. |
maxSpeed | The replacement maximum speed. Must be non-negative. |
RVO_API void RVO::RVOSimulator::setAgentNeighborDist | ( | size_t | agentNo, |
float | neighborDist | ||
) |
Sets the maximum neighbor distance of a specified agent.
agentNo | The number of the agent whose maximum neighbor distance is to be modified. |
neighborDist | The replacement maximum neighbor distance. Must be non-negative. |
RVO_API void RVO::RVOSimulator::setAgentPosition | ( | size_t | agentNo, |
const Vector3 & | position | ||
) |
Sets the three-dimensional position of a specified agent.
agentNo | The number of the agent whose three-dimensional position is to be modified. |
position | The replacement of the three-dimensional position. |
RVO_API void RVO::RVOSimulator::setAgentPrefVelocity | ( | size_t | agentNo, |
const Vector3 & | prefVelocity | ||
) |
Sets the three-dimensional preferred velocity of a specified agent.
agentNo | The number of the agent whose three-dimensional preferred velocity is to be modified. |
prefVelocity | The replacement of the three-dimensional preferred velocity. |
RVO_API void RVO::RVOSimulator::setAgentRadius | ( | size_t | agentNo, |
float | radius | ||
) |
Sets the radius of a specified agent.
agentNo | The number of the agent whose radius is to be modified. |
radius | The replacement radius. Must be non-negative. |
RVO_API void RVO::RVOSimulator::setAgentTimeHorizon | ( | size_t | agentNo, |
float | timeHorizon | ||
) |
Sets the time horizon of a specified agent with respect to other agents.
agentNo | The number of the agent whose time horizon is to be modified. |
timeHorizon | The replacement time horizon with respect to other agents. Must be positive. |
RVO_API void RVO::RVOSimulator::setAgentVelocity | ( | size_t | agentNo, |
const Vector3 & | velocity | ||
) |
Sets the three-dimensional linear velocity of a specified agent.
agentNo | The number of the agent whose three-dimensional linear velocity is to be modified. |
velocity | The replacement three-dimensional linear velocity. |
RVO_API void RVO::RVOSimulator::setTimeStep | ( | float | timeStep | ) |
Sets the time step of the simulation.
timeStep | The time step of the simulation. Must be positive. |