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 Member Functions | Protected Attributes | Friends | List of all members
Menge::NavMeshPoly Class Reference

The polygon used in each node of a navigation mesh graph. More...

#include <NavMeshPoly.h>

Public Member Functions

 NavMeshPoly ()
 Constructor.
 
 ~NavMeshPoly ()
 Destructor.
 
NavMeshPolyoperator= (const NavMeshPoly &n)
 Assignment operator.
 
bool containsPoint (const Vector2 &point) const
 Reports if the point lies inside the polygon. NOTE: This is limited to 2D polygons. More...
 
float getElevation (const Vector2 &point) const
 Computes the elevation of the polygon at the given point. More...
 
Vector2 getGradient () const
 Reports the gradient of the polygon. Because it is a plane, the gradient is constant at all positions. More...
 
bool loadFromAscii (std::ifstream &f)
 Sets the polygon properties from a polygon definition in the given ascii file stream. More...
 
bool loadFromBinary (std::ifstream &f)
 Sets the polygon properties from a polygon definition in the given binary file stream. More...
 
void initialize (size_t vCount, unsigned int *ids, float A=0.f, float B=0.f, float C=0.f)
 Initialize the polygon with vertices and equation of plane. More...
 

Protected Member Functions

void setBB (const Vector2 *vertices)
 Compute the bounding box for this polygon. More...
 

Protected Attributes

unsigned int * _vertIDs
 An array of indices into the vertex list defining the polygon. The indices must be ordered such that the vertices are visited in a counter-clockwise order. More...
 
size_t _vertCount
 The number of vertices in the polygon.
 
const Vector2_vertices
 A pointer to the mesh vertex information for performing geometric tests.
 
float _minX
 Minimum extent on the x-axis of the polygon.
 
float _maxX
 Maximum extent on the x-axis of the polygon.
 
float _minY
 Minimum extent on the y-axis of the polygon.
 
float _maxY
 Maximum extent on the y-axis of the polygon.
 
float _A
 The first coefficient of the planar equation: f( x, y ) = Ax + By + C Used to compute the elevation of the point on the polygon.
 
float _B
 The second coefficient of the planar equation: f( x, y ) = Ax + By + C Used to compute the elevation of the point on the polygon.
 
float _C
 The third coefficient of the planar equation: f( x, y ) = Ax + By + C Used to compute the elevation of the point on the polygon.
 

Friends

class NavMeshNode
 
class NavMesh
 

Detailed Description

The polygon used in each node of a navigation mesh graph.

Member Function Documentation

bool Menge::NavMeshPoly::containsPoint ( const Vector2 point) const

Reports if the point lies inside the polygon. NOTE: This is limited to 2D polygons.

Parameters
pointThe point to test.
Returns
A boolean reporting if the point is inside (true) or outside (false) the polygon TODO: Figure out what I do w.r.t. boundaries.
float Menge::NavMeshPoly::getElevation ( const Vector2 point) const

Computes the elevation of the polygon at the given point.

Parameters
pointA point on the polygon to evaluate. The function does not test to see if the point lies inside the polygon.
Returns
The elevation of the polygon at the given point.
Vector2 Menge::NavMeshPoly::getGradient ( ) const
inline

Reports the gradient of the polygon. Because it is a plane, the gradient is constant at all positions.

Returns
The gradient of the plane.
void Menge::NavMeshPoly::initialize ( size_t  vCount,
unsigned int *  ids,
float  A = 0.f,
float  B = 0.f,
float  C = 0.f 
)

Initialize the polygon with vertices and equation of plane.

Parameters
vCountNumber of vertices in the polygon.
idsAn array of index values into the global set of vertices in the navigation mesh.
AThe first coefficient of the planar equation: f( x, y ) = Ax + By + C
BThe second coefficient of the planar equation: f( x, y ) = Ax + By + C
CThe third coefficient of the planar equation: f( x, y ) = Ax + By + C
bool Menge::NavMeshPoly::loadFromAscii ( std::ifstream &  f)

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

Parameters
fThe input file stream.
Returns
A boolean indicating successful parsing (true) or failure (false).
bool Menge::NavMeshPoly::loadFromBinary ( std::ifstream &  f)

Sets the polygon properties from a polygon definition in the given binary file stream.

Parameters
fThe input file stream.
Returns
A boolean indicating successful parsing (true) or failure (false).
void Menge::NavMeshPoly::setBB ( const Vector2 vertices)
protected

Compute the bounding box for this polygon.

Parameters
verticesThe actucal vertices used for geometric queries.

Member Data Documentation

unsigned int* Menge::NavMeshPoly::_vertIDs
protected

An array of indices into the vertex list defining the polygon. The indices must be ordered such that the vertices are visited in a counter-clockwise order.

TODO: These are unsigned ints because of the binary file format. It would be better to decouple the file format from the representation.


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