Menge
Modular Pedestrian Simulation Framework for Research and Development
|
The definition of a preferred velocity. More...
#include <PrefVelocity.h>
Public Member Functions | |
PrefVelocity () | |
Default constructor. | |
PrefVelocity (const Vector2 &dir, float speed, const Vector2 &target) | |
Constructor for setting a span of a single direction. More... | |
PrefVelocity (const Vector2 &left, const Vector2 &right, const Vector2 &pref, float speed, const Vector2 &target) | |
Constructor for setting a full span. More... | |
PrefVelocity (const PrefVelocity &vel) | |
Copy constructor. More... | |
PrefVelocity & | operator= (const PrefVelocity &vel) |
Assignment operator. More... | |
Vector2 | getLeft () const |
Returns the left extent of the span. More... | |
Vector2 | getRight () const |
Returns the right extent of the span. More... | |
Vector2 | getPreferred () const |
Returns the preferred direction of the span. More... | |
Vector2 | getPreferredVel () const |
Returns the preferred *velocity" of the span. This is the preferred direction at the velocity's speed. More... | |
float | getSpeed () const |
Returns the speed of the preferred velocity. More... | |
void | setSpeed (float speed) |
Sets the speed. More... | |
void | setSingle (const Vector2 &dir) |
Sets the preferred velocity to be a single velocity. More... | |
Vector2 | getTarget () const |
Gets the target of the preferred velocity. More... | |
void | setTarget (const Vector2 &target) |
Sets the target of the preferred velocity. More... | |
void | setSpan (const Vector2 &left, const Vector2 &right, const Vector2 &preferred) |
Sets the preferred velocity span. More... | |
bool | hasArea () const |
Reports if the arc spans more than a single direction (by reporting whether the arc has area.) More... | |
Protected Attributes | |
Vector2 | _left |
The "left" extent of the preferred velocity span (i.e. det( right, left ) >= 0). This direction has unit length. | |
Vector2 | _right |
The "right" extent of the preferred velocity span (i.e. det( right, left ) >= 0). This direction has unit length. | |
float | _speed |
The preferred speed (also the radius of the arc. | |
Vector2 | _preferred |
The preferred direction. All directions in the span may be topologically equivalent, but this direction is the "best". This value must lie within the span (i.e., det( right, preferred ) > 0 and det( preferred, left) > 0). | |
Vector2 | _target |
The immediate goal point – this corresponds to the preferred direction. | |
The definition of a preferred velocity.
The preferred velocity is actually a space of velocities defined by two things:
For example, the shortest path may require an agent to pass down a hall way, but whether the agent walks down the left, middle, or side is irrelevant – all three will get the agent to its final goal with negligible difference.
Menge::Agents::PrefVelocity::PrefVelocity | ( | const Vector2 & | dir, |
float | speed, | ||
const Vector2 & | target | ||
) |
Constructor for setting a span of a single direction.
dir | The single direction. |
speed | The preferred speed. |
target | The target point from which the preferred direction arises. |
Menge::Agents::PrefVelocity::PrefVelocity | ( | const Vector2 & | left, |
const Vector2 & | right, | ||
const Vector2 & | pref, | ||
float | speed, | ||
const Vector2 & | target | ||
) |
Constructor for setting a full span.
left | The "left"-most extent of the span (see _left). |
right | The "right"-most extent of the span (see _right). |
pref | The preferred direction (see _preferred). |
speed | The preferred speed. |
target | The target point from which the preferred direction arises. |
Menge::Agents::PrefVelocity::PrefVelocity | ( | const PrefVelocity & | vel | ) |
Copy constructor.
vel | An instance of preferred velocity. |
|
inline |
Returns the left extent of the span.
|
inline |
Returns the preferred direction of the span.
|
inline |
Returns the preferred *velocity" of the span. This is the preferred direction at the velocity's speed.
|
inline |
Returns the right extent of the span.
|
inline |
Returns the speed of the preferred velocity.
|
inline |
Gets the target of the preferred velocity.
|
inline |
Reports if the arc spans more than a single direction (by reporting whether the arc has area.)
PrefVelocity & Menge::Agents::PrefVelocity::operator= | ( | const PrefVelocity & | vel | ) |
Assignment operator.
vel | Another instance of PrefVelocity whose values will be copied into this. |
|
inline |
Sets the preferred velocity to be a single velocity.
dir | The single preferred direction. |
void Menge::Agents::PrefVelocity::setSpan | ( | const Vector2 & | left, |
const Vector2 & | right, | ||
const Vector2 & | preferred | ||
) |
Sets the preferred velocity span.
left | The direction of the left-most extent of the arc. |
right | The direction of the right-most extent of the arc. |
preferred | The single most-preferred direction in the span. |
|
inline |
Sets the speed.
speed | The speed. |
|
inline |
Sets the target of the preferred velocity.
target | The preferred velocity's target. |