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::VFVelComponent Class Reference

A velocity component that returns a preferred velocity whose direction and preferred speed are computed from a velocity field. More...

#include <VelCompVF.h>

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

Public Member Functions

 VFVelComponent ()
 Default constructor.
 
 VFVelComponent (VectorFieldPtr &vf, bool useNearest)
 Constructor. More...
 
void setUseNearest (bool useNearest)
 Determines whether the vector field velocity component computes velocity from the nearest cell center or from a bilinear interpolation on the four near-by cells. More...
 
void setVectorField (const VectorFieldPtr &vf)
 Sets the velocity field pointer. More...
 
virtual void setPrefVelocity (const Agents::BaseAgent *agent, const Goal *goal, Agents::PrefVelocity &pVel)
 Computes and sets the agent's preferred velocity. 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

VectorFieldPtr _vf
 The vector field resource which provides preferred velocity vectors.
 
bool _nearest
 Determines if the vector selection is based on nearest (true) or bilinear interpolation (false)
 

Friends

class VecFieldVCContext
 

Additional Inherited Members

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

Detailed Description

A velocity component that returns a preferred velocity whose direction and preferred speed are computed from a velocity field.

If the velocity vector is of unit length, the preferred speed will be unchanged. Otherwise, the preferred speed is scaled by the length of the velocity vector.

Constructor & Destructor Documentation

Menge::BFSM::VFVelComponent::VFVelComponent ( VectorFieldPtr vf,
bool  useNearest 
)

Constructor.

Parameters
vfThe VectorField to use for velocity computation.
useNearestDetermines if the velocity is computed by selecting the neareset vector (true) or the bilinear interpolation of four near-by cells (false).

Member Function Documentation

VelCompContext * Menge::BFSM::VFVelComponent::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::VFVelComponent::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.

void Menge::BFSM::VFVelComponent::setUseNearest ( bool  useNearest)
inline

Determines whether the vector field velocity component computes velocity from the nearest cell center or from a bilinear interpolation on the four near-by cells.

Parameters
useNearestUses only nearest cell if true, 4-cell neighborhood if false.
void Menge::BFSM::VFVelComponent::setVectorField ( const VectorFieldPtr vf)
inline

Sets the velocity field pointer.

Parameters
vfThe managed pointer to the velocity field.

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