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

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

#include <VelCompNavMesh.h>

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

Public Member Functions

 NavMeshVelComponent ()
 Default constructor.
 
virtual void onExit (Agents::BaseAgent *agent)
 Called when the agent exits the state that uses this velocity component. More...
 
void setNavMesh (const NavMeshPtr &nm)
 Sets the navigation mesh pointer. More...
 
NavMeshPtr getNavMesh ()
 Returns a resource pointer to the underlying navigation mesh. More...
 
NavMeshLocalizerPtr getLocalizer ()
 Returns a resource pointer to the underlying navigation mesh localizer. More...
 
void setNavMeshLocalizer (const NavMeshLocalizerPtr &nml)
 Sets the navigation mesh localizer pointer. More...
 
void setHeadingDeviation (float angle)
 Sets the angular deviation which triggers replanning. 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...
 
virtual TaskgetTask ()
 Returns a pointer to the nav mesh localizer task. 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...
 
- Public Member Functions inherited from Menge::Element
void destroy ()
 This supplants the destructor. More...
 
virtual SceneGraph::GLNodegetSGNode ()
 Returns an optional visualization element associated with the element. More...
 

Protected Attributes

float _headingDevCos
 The cosine of the heading deviation angular threshold. This detects when the angle of approach deviates beyond a threshold and the agent needs to replan.
 
NavMeshPtr _navMesh
 The navigation mesh.
 
NavMeshLocalizerPtr _localizer
 The localizer for the navigation mesh.
 

Friends

class NavMeshVCContext
 

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 navigation mesh.

A navigation mesh is a representation of the traversalbe space. The traversable space is represented as a polygonal mesh. Graph searches through the mesh are performed to find paths through arbitrarily complex environments.

Member Function Documentation

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

NavMeshLocalizerPtr Menge::BFSM::NavMeshVelComponent::getLocalizer ( )
inline

Returns a resource pointer to the underlying navigation mesh localizer.

Returns
The navigation mesh localizer.
NavMeshPtr Menge::BFSM::NavMeshVelComponent::getNavMesh ( )
inline

Returns a resource pointer to the underlying navigation mesh.

Returns
The navigation mesh.
BFSM::Task * Menge::BFSM::NavMeshVelComponent::getTask ( )
virtual

Returns a pointer to the nav mesh localizer task.

Returns
A pointer to the nav mesh localizer task. It is the responsibility of the caller to free the memory of the provided task by calling its destroy method.

Reimplemented from Menge::Element.

void Menge::BFSM::NavMeshVelComponent::onExit ( Agents::BaseAgent agent)
virtual

Called when the agent exits the state that uses this velocity component.

Parameters
agentThe agent exiting the state.

Reimplemented from Menge::BFSM::VelComponent.

void Menge::BFSM::NavMeshVelComponent::setHeadingDeviation ( float  angle)

Sets the angular deviation which triggers replanning.

Parameters
angleThe angle of deviation in radians.
void Menge::BFSM::NavMeshVelComponent::setNavMesh ( const NavMeshPtr nm)
inline

Sets the navigation mesh pointer.

Parameters
nmThe managed pointer to the navigation mesh.
void Menge::BFSM::NavMeshVelComponent::setNavMeshLocalizer ( const NavMeshLocalizerPtr nml)
inline

Sets the navigation mesh localizer pointer.

Parameters
nmlThe managed pointer to the navigation mesh localizer.
void Menge::BFSM::NavMeshVelComponent::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: