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

The basic structure defining a way "point" along a path through a navigation mesh. It consists of the navigation mesh edge to pass through and the node one should be in while heading to the edge. More...

#include <WayPortal.h>

Public Member Functions

 WayPortal (const NavMeshEdge *edge, unsigned int nodeID, bool p0IsLeft)
 Constructor. More...
 
Vector2 getLeft () const
 Retrives the left physical vertex of the portal. More...
 
Vector2 getLeft (float offset) const
 Retrives the position in the portal offset from the left physical vertex. More...
 
Vector2 getRight () const
 Retrives the right physical vertex of the portal. More...
 
Vector2 getRight (float offset) const
 Retrives the position in the portal offset from the right physical vertex. More...
 
Vector2 intersectionPoint (const Vector2 &point, const Vector2 &dir) const
 Computes the intersection point of the given line with this portal. More...
 
void setPreferredDirection (const Vector2 &pos, float radius, const Vector2 &dir, Agents::PrefVelocity &pVel) const
 Sets the directions on the preferred velocity based on the wayportal. More...
 

Protected Attributes

const NavMeshEdge_edge
 The edge which serves as goal.
 
unsigned int _nodeID
 The index of the node in which the agent is traveling toward the edge. It should be true that the specified node is attached/connected to the given edge.
 
bool _p0IsLeft
 Reports if the edge's P0 is the left vertex. Left is defined based on moving across the portal from the node indicated by _nodeID;.
 

Friends

class PortalRoute
 
class PortalPath
 

Detailed Description

The basic structure defining a way "point" along a path through a navigation mesh. It consists of the navigation mesh edge to pass through and the node one should be in while heading to the edge.

Constructor & Destructor Documentation

Menge::WayPortal::WayPortal ( const NavMeshEdge edge,
unsigned int  nodeID,
bool  p0IsLeft 
)

Constructor.

Parameters
edgeThe NavigationMeshEdge which serves as the immediate goal for this WayPortal.
nodeIDThe nav mesh node that an agent should be in while heading for this node.
p0IsLeftIndicates if the p0 value of the edge is on the left, when faced from inside the node.

Member Function Documentation

Vector2 Menge::WayPortal::getLeft ( ) const
inline

Retrives the left physical vertex of the portal.

Returns
The position of the left physical vertex, as viewed from inside _nodeID.
Vector2 Menge::WayPortal::getLeft ( float  offset) const
inline

Retrives the position in the portal offset from the left physical vertex.

Parameters
offsetThe distance offset from the left physical vertex.
Returns
The position offset from the left physical vertex, as viewed from inside _nodeID.
Vector2 Menge::WayPortal::getRight ( ) const
inline

Retrives the right physical vertex of the portal.

Returns
The position of the right physical vertex, as viewed from inside _nodeID.
Vector2 Menge::WayPortal::getRight ( float  offset) const
inline

Retrives the position in the portal offset from the right physical vertex.

Parameters
offsetThe distance offset from the right physical vertex.
Returns
The position offset from the right physical vertex, as viewed from inside _nodeID.
Vector2 Menge::WayPortal::intersectionPoint ( const Vector2 point,
const Vector2 dir 
) const

Computes the intersection point of the given line with this portal.

This algorithm ASSUMES that the line DOES intersect the portal. The behavior is undefined if they don't intersect.

Parameters
pointA point on the line to test.
dirA direction vector defining the position of the line.
Returns
A point, on the portal, at which the line intersects.
void Menge::WayPortal::setPreferredDirection ( const Vector2 pos,
float  radius,
const Vector2 dir,
Agents::PrefVelocity pVel 
) const

Sets the directions on the preferred velocity based on the wayportal.

Parameters
posThe position of the agent.
radiusThe radius of the agent.
dirPreferred direction of the agent. Direction is NOT assumed to be of unit-length.
pVelThe preferred velocity

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