Menge
Modular Pedestrian Simulation Framework for Research and Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
Menge::Agents::PrefVelocity Class Reference

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...
 
PrefVelocityoperator= (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

Menge::Agents::PrefVelocity::PrefVelocity ( const Vector2 dir,
float  speed,
const Vector2 target 
)

Constructor for setting a span of a single direction.

Parameters
dirThe single direction.
speedThe preferred speed.
targetThe 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.

Parameters
leftThe "left"-most extent of the span (see _left).
rightThe "right"-most extent of the span (see _right).
prefThe preferred direction (see _preferred).
speedThe preferred speed.
targetThe target point from which the preferred direction arises.
Menge::Agents::PrefVelocity::PrefVelocity ( const PrefVelocity vel)

Copy constructor.

Parameters
velAn instance of preferred velocity.

Member Function Documentation

Vector2 Menge::Agents::PrefVelocity::getLeft ( ) const
inline

Returns the left extent of the span.

Returns
The left extent.
Vector2 Menge::Agents::PrefVelocity::getPreferred ( ) const
inline

Returns the preferred direction of the span.

Returns
The preferred direction.
Vector2 Menge::Agents::PrefVelocity::getPreferredVel ( ) const
inline

Returns the preferred *velocity" of the span. This is the preferred direction at the velocity's speed.

Returns
A vector pointing in the preferred direction at the given speed.
Vector2 Menge::Agents::PrefVelocity::getRight ( ) const
inline

Returns the right extent of the span.

Returns
The right extent.
float Menge::Agents::PrefVelocity::getSpeed ( ) const
inline

Returns the speed of the preferred velocity.

Returns
The speed of the preferred velocity.
Vector2 Menge::Agents::PrefVelocity::getTarget ( ) const
inline

Gets the target of the preferred velocity.

Returns
A singe point in space which corresponds to the preferred direction.
bool Menge::Agents::PrefVelocity::hasArea ( ) const
inline

Reports if the arc spans more than a single direction (by reporting whether the arc has area.)

Returns
A boolean indicating if the span has area (i.e. spans more than a single direction.
PrefVelocity & Menge::Agents::PrefVelocity::operator= ( const PrefVelocity vel)

Assignment operator.

Parameters
velAnother instance of PrefVelocity whose values will be copied into this.
Returns
A reference to this preferred velocity.
void Menge::Agents::PrefVelocity::setSingle ( const Vector2 dir)
inline

Sets the preferred velocity to be a single velocity.

Parameters
dirThe single preferred direction.
void Menge::Agents::PrefVelocity::setSpan ( const Vector2 left,
const Vector2 right,
const Vector2 preferred 
)

Sets the preferred velocity span.

Parameters
leftThe direction of the left-most extent of the arc.
rightThe direction of the right-most extent of the arc.
preferredThe single most-preferred direction in the span.
void Menge::Agents::PrefVelocity::setSpeed ( float  speed)
inline

Sets the speed.

Parameters
speedThe speed.
void Menge::Agents::PrefVelocity::setTarget ( const Vector2 target)
inline

Sets the target of the preferred velocity.

Parameters
targetThe preferred velocity's target.

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