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 | Friends | List of all members
Menge::BFSM::ConstVelDirComponent Class Reference

A velocity component that always returns a constant direction but leaves the preferred speed unchanged. More...

#include <VelCompConst.h>

Inheritance diagram for Menge::BFSM::ConstVelDirComponent:
Menge::BFSM::VelComponent Menge::Element

Public Member Functions

 ConstVelDirComponent ()
 Default constructor.
 
 ConstVelDirComponent (const Vector2 &vel)
 Constructor. More...
 
virtual void setPrefVelocity (const Agents::BaseAgent *agent, const Goal *goal, Agents::PrefVelocity &pVel)
 Computes and sets the agent's preferred velocity. More...
 
void setDirection (const Vector2 &dir)
 Sets the direction of the velocity component. More...
 
virtual VelCompContextgetContext ()
 Provides a display context for interacting with this velocity component. More...
 
- Public Member Functions inherited from Menge::BFSM::VelComponent
 VelComponent ()
 Default constructor.
 
virtual void onEnter (Agents::BaseAgent *agent)
 Called when the agent enters the state which possesses this velocity component. More...
 
virtual void onExit (Agents::BaseAgent *agent)
 Called when the agent leaves the state which possesses this velocity component. More...
 
- Public Member Functions inherited from Menge::Element
void destroy ()
 This supplants the destructor. More...
 
virtual BFSM::TaskgetTask ()
 Return an optional task associated with this element. More...
 
virtual SceneGraph::GLNodegetSGNode ()
 Returns an optional visualization element associated with the element. More...
 

Protected Attributes

Vector2 _dir
 The direction of the constant preferred velocity.
 

Friends

class ConstDirVCContext
 

Additional Inherited Members

- Protected Member Functions inherited from Menge::BFSM::VelComponent
virtual ~VelComponent ()
 Virtual destructor.
 

Detailed Description

A velocity component that always returns a constant direction but leaves the preferred speed unchanged.

Constructor & Destructor Documentation

Menge::BFSM::ConstVelDirComponent::ConstVelDirComponent ( const Vector2 vel)

Constructor.

Parameters
velThe preferred velocity direction to return (vel is not assumed to be unit-length).

Member Function Documentation

VelCompContext * Menge::BFSM::ConstVelDirComponent::getContext ( )
virtual

Provides a display context for interacting with this velocity component.

It is the responsibility of the caller to delete the provided context.

Returns
A pointer to a context for this vel component.

Reimplemented from Menge::BFSM::VelComponent.

void Menge::BFSM::ConstVelDirComponent::setDirection ( const Vector2 dir)

Sets the direction of the velocity component.

Parameters
dirThe direction the velocity should provide. The input need not be normalized, as tha will be done by this function.
void Menge::BFSM::ConstVelDirComponent::setPrefVelocity ( const Agents::BaseAgent agent,
const Goal goal,
Agents::PrefVelocity pVel 
)
virtual

Computes and sets the agent's preferred velocity.

The velocity component directly sets preferred velocity values in the the provided preferred velocity instance. See Agents::PrefVelocity for details. Rather than setting the agent's preferred velocity value directly, a reference to a preferred velocity instance is passed in to make the use more general. This allows the computation of the preferred velocity for the agent, without necessarily making changes to it.

Parameters
agentThe agent for which a preferred velocity is computed.
goalThe agent's goal (although this may be ignored).
pVelThe instance of Agents::PrefVelocity to set.

Implements Menge::BFSM::VelComponent.


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