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

Specification of an obstacle. It is the same as a pedModel specification but includes a pointer to a node to which it is attached. More...

#include <NavMeshObstacle.h>

Inheritance diagram for Menge::NavMeshObstacle:
Menge::Agents::Obstacle

Public Member Functions

 NavMeshObstacle ()
 Constructor.
 
bool loadFromAscii (std::ifstream &f, Vector2 *vertices)
 Sets the obstacle properties from an obstacle definition in the given ascii file stream. More...
 
const NavMeshNodegetNode () const
 Retrieve the nav mesh node to which this obstacle is adjacent. More...
 
- Public Member Functions inherited from Menge::Agents::Obstacle
 Obstacle ()
 Constructs a static obstacle instance.
 
 ~Obstacle ()
 Destroys this static obstacle instance.
 
Vector2 normal () const
 Retrieves the normal of the obstacle. More...
 
const Vector2getP0 () const
 Retrieve the first point on the obstacle.
 
const Vector2 midPt () const
 Retrieve the obstacle's mid-point.
 
Vector2 getP1 () const
 Retrieve the second point on the obstacle.
 
const Obstaclenext () const
 Returns the next obstacle in sequence.
 
NearTypeEnum distanceSqToPoint (const Vector2 &pt, Vector2 &nearPt, float &distSq) const
 Computes the squared distance from the obstacle to the given point. Also sets the value of the point in the provided Vector2. More...
 
float circleIntersection (const Vector2 &dir, const Vector2 &start, float radius) const
 Determines if a circle, moving along a ray, will intersect the obstacle. More...
 
float length () const
 Returns the length of the obstacle. More...
 
bool pointOnObstacle (const Vector2 &pt) const
 Reports if the given point lies on the obstacle. More...
 
bool pointOutside (const Vector2 &point) const
 Reports if the given point is on the "outside" of the obstacle. This definition depends on whether the obstacle is double-sided or not. More...
 
bool p0Convex (bool agtOnRight) const
 Reports if the obstacle is convext at _point. More...
 
bool p1Convex (bool agtOnRight) const
 Reports if the obstacle is convext at _point + _length * _unitDir. More...
 
void setClosedState (bool closed)
 Sets the obstacle's closed state. More...
 

Static Public Attributes

static unsigned int NO_NEIGHBOR_OBST = std::numeric_limits< unsigned int >::max()
 The index value if the obstacle has no neighboring obstacle.
 

Protected Attributes

NavMeshNode_node
 A nav mesh node to which this obstacle is attached. It could be attached to multiple, but this is the node for which it serves as an edge.
 

Friends

class NavMeshNode
 
class NavMesh
 

Additional Inherited Members

- Public Types inherited from Menge::Agents::Obstacle
enum  NearTypeEnum { FIRST, MIDDLE, LAST }
 An enumeration to define the type of nearest point - first, middle, last.
 
- Public Attributes inherited from Menge::Agents::Obstacle
bool _doubleSided
 Reports if the obstacle is double sided. More...
 
bool _isConvex
 Reports if the obstacle is convex around the obstacle's point (_point).
 
Obstacle_nextObstacle
 Pointer to the next obstacle in the greater obstacle structure. If the obstacle is open, it could be NULL.
 
Vector2 _point
 The point from which the obstacle is defined.
 
Obstacle_prevObstacle
 Pointer to the previous obstacle in the greater obstacle structure. If the obstacle is open, it could be NULL.
 
Vector2 _unitDir
 The direction the obstacle extends from the originating point.
 
float _length
 The distance in the direction the obstacle extends.
 
size_t _id
 A unique identifier for this obstacle.
 
size_t _class
 The class of obstacle, used so agents can ignore/include obstacles.
 

Detailed Description

Specification of an obstacle. It is the same as a pedModel specification but includes a pointer to a node to which it is attached.

Member Function Documentation

const NavMeshNode* Menge::NavMeshObstacle::getNode ( ) const
inline

Retrieve the nav mesh node to which this obstacle is adjacent.

Returns
A pointer to the node.
bool Menge::NavMeshObstacle::loadFromAscii ( std::ifstream &  f,
Vector2 vertices 
)

Sets the obstacle properties from an obstacle definition in the given ascii file stream.

Parameters
fThe input file stream.
verticesThe array of vertices into which the definition indexes.
Returns
A boolean indicating successful parsing (true) or failure (false).

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