Planeshift
Public Member Functions

dtPathCorridor Class Reference

Represents a dynamic polygon corridor used to plan agent movement. ,. More...

#include <DetourPathCorridor.h>

List of all members.

Public Member Functions

 dtPathCorridor ()
int findCorners (float *cornerVerts, unsigned char *cornerFlags, dtPolyRef *cornerPolys, const int maxCorners, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 Finds the corners in the corridor from the position toward the target. (The straightened path.)
bool fixPathStart (dtPolyRef safeRef, const float *safePos)
dtPolyRef getFirstPoly () const
 The polygon reference id of the first polygon in the corridor, the polygon containing the position.
dtPolyRef getLastPoly () const
 The polygon reference id of the last polygon in the corridor, the polygon containing the target.
const dtPolyRefgetPath () const
 The corridor's path.
int getPathCount () const
 The number of polygons in the current corridor path.
const floatgetPos () const
 Gets the current position within the corridor. (In the first polygon.)
const floatgetTarget () const
 Gets the current target within the corridor. (In the last polygon.)
bool init (const int maxPath)
 Allocates the corridor's path buffer.
bool isValid (const int maxLookAhead, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 Checks the current corridor path to see if its polygon references remain valid.
bool moveOverOffmeshConnection (dtPolyRef offMeshConRef, dtPolyRef *refs, float *startPos, float *endPos, dtNavMeshQuery *navquery)
void movePosition (const float *npos, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 Moves the position from the current location to the desired location, adjusting the corridor as needed to reflect the change.
void moveTargetPosition (const float *npos, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 Moves the target from the curent location to the desired location, adjusting the corridor as needed to reflect the change.
bool optimizePathTopology (dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 Attempts to optimize the path using a local area search. (Partial replanning.)
void optimizePathVisibility (const float *next, const float pathOptimizationRange, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 Attempts to optimize the path if the specified point is visible from the current position.
void reset (dtPolyRef ref, const float *pos)
 Resets the path corridor to the specified position.
void setCorridor (const float *target, const dtPolyRef *polys, const int npath)
 Loads a new path and target into the corridor.
bool trimInvalidPath (dtPolyRef safeRef, const float *safePos, dtNavMeshQuery *navquery, const dtQueryFilter *filter)
 ~dtPathCorridor ()

Detailed Description

Represents a dynamic polygon corridor used to plan agent movement. ,.

Definition at line 26 of file DetourPathCorridor.h.


Constructor & Destructor Documentation

dtPathCorridor::dtPathCorridor ( )
dtPathCorridor::~dtPathCorridor ( )

Member Function Documentation

int dtPathCorridor::findCorners ( float cornerVerts,
unsigned char *  cornerFlags,
dtPolyRef cornerPolys,
const int  maxCorners,
dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

Finds the corners in the corridor from the position toward the target. (The straightened path.)

Parameters:
[out]cornerVertsThe corner vertices. [(x, y, z) * cornerCount] [Size: <= maxCorners]
[out]cornerFlagsThe flag for each corner. [(flag) * cornerCount] [Size: <= maxCorners]
[out]cornerPolysThe polygon reference for each corner. [(polyRef) * cornerCount] [Size: <= maxCorners]
[in]maxCornersThe maximum number of corners the buffers can hold.
[in]navqueryThe query object used to build the corridor.
[in]filterThe filter to apply to the operation.
Returns:
The number of corners returned in the corner buffers. [0 <= value <= maxCorners]
bool dtPathCorridor::fixPathStart ( dtPolyRef  safeRef,
const float safePos 
)
dtPolyRef dtPathCorridor::getFirstPoly ( ) const [inline]

The polygon reference id of the first polygon in the corridor, the polygon containing the position.

Returns:
The polygon reference id of the first polygon in the corridor. (Or zero if there is no path.)

Definition at line 120 of file DetourPathCorridor.h.

dtPolyRef dtPathCorridor::getLastPoly ( ) const [inline]

The polygon reference id of the last polygon in the corridor, the polygon containing the target.

Returns:
The polygon reference id of the last polygon in the corridor. (Or zero if there is no path.)

Definition at line 124 of file DetourPathCorridor.h.

const dtPolyRef* dtPathCorridor::getPath ( ) const [inline]

The corridor's path.

Returns:
The corridor's path. [(polyRef) * getPathCount()]

Definition at line 128 of file DetourPathCorridor.h.

int dtPathCorridor::getPathCount ( ) const [inline]

The number of polygons in the current corridor path.

Returns:
The number of polygons in the current corridor path.

Definition at line 132 of file DetourPathCorridor.h.

const float* dtPathCorridor::getPos ( ) const [inline]

Gets the current position within the corridor. (In the first polygon.)

Returns:
The current position within the corridor.

Definition at line 112 of file DetourPathCorridor.h.

const float* dtPathCorridor::getTarget ( ) const [inline]

Gets the current target within the corridor. (In the last polygon.)

Returns:
The current target within the corridor.

Definition at line 116 of file DetourPathCorridor.h.

bool dtPathCorridor::init ( const int  maxPath)

Allocates the corridor's path buffer.

Parameters:
[in]maxPathThe maximum path size the corridor can handle.
Returns:
True if the initialization succeeded.
bool dtPathCorridor::isValid ( const int  maxLookAhead,
dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

Checks the current corridor path to see if its polygon references remain valid.

Parameters:
[in]maxLookAheadThe number of polygons from the beginning of the corridor to search.
[in]navqueryThe query object used to build the corridor.
[in]filterThe filter to apply to the operation.
bool dtPathCorridor::moveOverOffmeshConnection ( dtPolyRef  offMeshConRef,
dtPolyRef refs,
float startPos,
float endPos,
dtNavMeshQuery navquery 
)
void dtPathCorridor::movePosition ( const float npos,
dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

Moves the position from the current location to the desired location, adjusting the corridor as needed to reflect the change.

Parameters:
[in]nposThe desired new position. [(x, y, z)]
[in]navqueryThe query object used to build the corridor.
[in]filterThe filter to apply to the operation.
void dtPathCorridor::moveTargetPosition ( const float npos,
dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

Moves the target from the curent location to the desired location, adjusting the corridor as needed to reflect the change.

Parameters:
[in]nposThe desired new target position. [(x, y, z)]
[in]navqueryThe query object used to build the corridor.
[in]filterThe filter to apply to the operation.
bool dtPathCorridor::optimizePathTopology ( dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

Attempts to optimize the path using a local area search. (Partial replanning.)

Parameters:
[in]navqueryThe query object used to build the corridor.
[in]filterThe filter to apply to the operation.
void dtPathCorridor::optimizePathVisibility ( const float next,
const float  pathOptimizationRange,
dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

Attempts to optimize the path if the specified point is visible from the current position.

Parameters:
[in]nextThe point to search toward. [(x, y, z])
[in]pathOptimizationRangeThe maximum range to search. [Limit: > 0]
[in]navqueryThe query object used to build the corridor.
[in]filterThe filter to apply to the operation.
void dtPathCorridor::reset ( dtPolyRef  ref,
const float pos 
)

Resets the path corridor to the specified position.

Parameters:
[in]refThe polygon reference containing the position.
[in]posThe new position in the corridor. [(x, y, z)]
void dtPathCorridor::setCorridor ( const float target,
const dtPolyRef polys,
const int  npath 
)

Loads a new path and target into the corridor.

Parameters:
[in]targetThe target location within the last polygon of the path. [(x, y, z)]
[in]pathThe path corridor. [(polyRef) * npolys]
[in]npathThe number of polygons in the path.
bool dtPathCorridor::trimInvalidPath ( dtPolyRef  safeRef,
const float safePos,
dtNavMeshQuery navquery,
const dtQueryFilter filter 
)

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