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

The navigation mesh adjacency graph node. It corresponds to a convex polygon in the navigation mesh. More...

#include <NavMeshNode.h>

Public Member Functions

 NavMeshNode ()
 Constructor.
 
 ~NavMeshNode ()
 Destructor.
 
NavMeshNodeoperator= (const NavMeshNode &n)
 Assignment operator.
 
void setID (unsigned int id)
 Sets the node identifier. More...
 
unsigned int getID () const
 Retrive the identifier for this node.
 
void setCenter (const Vector2 &c)
 Sets the node's center value. More...
 
Vector2 getCenter () const
 Reports the center (centroid) of the node's polygon. More...
 
Vector3 getCenter3D () const
 Reports the center (centroid) of the node's polygon. More...
 
size_t getVertexCount () const
 Returns the number of vertices in the node's polygon. More...
 
void setVertices (const Vector2 *vertices)
 Sets this node's polygon to the given vertex array. The polygon can then evaluate its indices with respect to this array of vertex values. More...
 
unsigned int getVertexID (size_t i) const
 Gets the index of the ith vertex in this node's polygon. More...
 
size_t getObstacleCount () const
 Returns the number of obstacles connected to this node. More...
 
const NavMeshObstaclegetObstacle (size_t i) const
 Returns a const pointer to the ith obstacle in the node. More...
 
NavMeshObstaclegetObstacle (size_t i)
 Returns a const pointer to the ith obstacle in the node. More...
 
size_t getNeighborCount () const
 Reports the number of nodes adjacent to this node.
 
const NavMeshNodegetNeighbor (size_t i) const
 Returns a pointer to the ith neighbor. More...
 
size_t getEdgeCount () const
 Reports the number of edges on the node. More...
 
NavMeshEdgegetEdge (size_t i)
 Retrieves the ith edge connected to this node. More...
 
const NavMeshEdgegetEdge (size_t i) const
 Retrieves a const pointer to the ith edge connected to this node. More...
 
NavMeshEdgegetConnection (unsigned nodeID)
 Returns the pointer to the edge connecting this node with the node whose identifier is given. More...
 
bool containsPoint (const Vector2 &point) const
 Reports if the given point is inside the polygon. More...
 
bool loadFromAscii (std::ifstream &f)
 Sets the node properties from a node definition in the given ascii file stream. More...
 
float getElevation (const Vector2 &p) const
 Computes the height based on this node's polygon.
 
Vector2 getGradient () const
 Computes the gradient based on this node's polygon.
 

Protected Attributes

NavMeshEdge ** _edges
 An array of edges connecting to other nodes.
 
size_t _edgeCount
 The number of edges connecting to this node.
 
NavMeshObstacle ** _obstacles
 An array of obstacles connected to this node.
 
size_t _obstCount
 The number of obstacles connecting to this node.
 
Vector2 _center
 The "position" of the node - used to compute distance between node and goal (A* heuristic)
 
NavMeshPoly _poly
 The polygon associated with this node.
 
unsigned int _id
 The identifier of this node.
 

Friends

class NavMesh
 
class NavMeshEdge
 
class PathPlanner
 

Detailed Description

The navigation mesh adjacency graph node. It corresponds to a convex polygon in the navigation mesh.

Member Function Documentation

bool Menge::NavMeshNode::containsPoint ( const Vector2 point) const
inline

Reports if the given point is inside the polygon.

Parameters
pointThe point to test.
Returns
A boolean reporting if the point lies inside the polygon (true) or outside (false ). // TODO: What about the boundary?
Vector2 Menge::NavMeshNode::getCenter ( ) const
inline

Reports the center (centroid) of the node's polygon.

Returns
The position of the polygon's centroid.
Vector3 Menge::NavMeshNode::getCenter3D ( ) const
inline

Reports the center (centroid) of the node's polygon.

Returns
The position of the polygon's centroid.
NavMeshEdge * Menge::NavMeshNode::getConnection ( unsigned  nodeID)

Returns the pointer to the edge connecting this node with the node whose identifier is given.

Parameters
nodeIDThe id of the desired adjacent node.
Returns
The pointer to the edge connecting the two nodes. If the nodes are not connected, NULL is returned.
NavMeshEdge* Menge::NavMeshNode::getEdge ( size_t  i)
inline

Retrieves the ith edge connected to this node.

Parameters
iThe local index of the desired edge.
Returns
A pointer to the ith edge.
const NavMeshEdge* Menge::NavMeshNode::getEdge ( size_t  i) const
inline

Retrieves a const pointer to the ith edge connected to this node.

Parameters
iThe local index of the desired edge.
Returns
A pointer to the ith edge.
size_t Menge::NavMeshNode::getEdgeCount ( ) const
inline

Reports the number of edges on the node.

Returns
The number of edges.
const NavMeshNode * Menge::NavMeshNode::getNeighbor ( size_t  i) const

Returns a pointer to the ith neighbor.

Parameters
iThe index of the neighboring node to retrieve. The index is defined in the range [0, N-1], where this node has N neighbors.
Returns
A pointer to the ith neighboring node.
const NavMeshObstacle* Menge::NavMeshNode::getObstacle ( size_t  i) const
inline

Returns a const pointer to the ith obstacle in the node.

Parameters
iThe local index of the desired obstacle.
Returns
A const pointer to the ith obstacle.
NavMeshObstacle* Menge::NavMeshNode::getObstacle ( size_t  i)
inline

Returns a const pointer to the ith obstacle in the node.

Parameters
iThe local index of the desired obstacle.
Returns
A pointer to the ith obstacle.
size_t Menge::NavMeshNode::getObstacleCount ( ) const
inline

Returns the number of obstacles connected to this node.

Returns
The number of obtacles in on this node.
size_t Menge::NavMeshNode::getVertexCount ( ) const
inline

Returns the number of vertices in the node's polygon.

Returns
The number of vertices in the polygon.
unsigned int Menge::NavMeshNode::getVertexID ( size_t  i) const
inline

Gets the index of the ith vertex in this node's polygon.

Parameters
iThe local index of the vertex in the node's polygon.
Returns
The global index in the navigation mesh of the ith vertex in this node's polygon.
bool Menge::NavMeshNode::loadFromAscii ( std::ifstream &  f)

Sets the node properties from a node definition in the given ascii file stream.

Parameters
fThe input file stream.
Returns
A boolean indicating successful parsing (true) or failure (false).
void Menge::NavMeshNode::setCenter ( const Vector2 c)
inline

Sets the node's center value.

Parameters
cThe point value to set.
void Menge::NavMeshNode::setID ( unsigned int  id)
inline

Sets the node identifier.

Parameters
idThe identifier to set this node to.
void Menge::NavMeshNode::setVertices ( const Vector2 vertices)
inline

Sets this node's polygon to the given vertex array. The polygon can then evaluate its indices with respect to this array of vertex values.

Parameters
verticesAn array of Vector2's defining the polygon vertices.

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