PolyVox  0.2.1
Open source voxel management library
Public Member Functions | Public Attributes
PolyVox::AStarPathfinderParams< VolumeType > Struct Template Reference

Provides a configuration for the AStarPathfinder. More...

#include <AStarPathfinder.h>

+ Collaboration diagram for PolyVox::AStarPathfinderParams< VolumeType >:

List of all members.

Public Member Functions

 AStarPathfinderParams (VolumeType *volData, const Vector3DInt32 &v3dStart, const Vector3DInt32 &v3dEnd, std::list< Vector3DInt32 > *listResult, float fHBias=1.0, uint32_t uMaxNoOfNodes=10000, Connectivity requiredConnectivity=TwentySixConnected, std::function< bool(const VolumeType *, const Vector3DInt32 &)> funcIsVoxelValidForPath=&aStarDefaultVoxelValidator, std::function< void(float)> funcProgressCallback=0)

Public Attributes

VolumeType * volume
 This is the volume through which the AStarPathfinder must find a path.
Vector3DInt32 start
 The start point for the pathfinding algorithm.
Vector3DInt32 end
 The end point for the pathfinding algorithm.
std::list< Vector3DInt32 > * result
 The resulting path will be stored as a series of points in this list.
Connectivity connectivity
 The AStarPathfinder performs its search by examining the neighbours of each voxel it encounters.
float hBias
 For each voxel the pathfinder tracks its distance to the start (known as g()) and estimates its distance to the end (known as h()).
uint32_t maxNumberOfNodes
 Volumes can be pretty huge (millions of voxels) and processing each one of these can take a long time.
std::function< bool(const
VolumeType *, const
Vector3DInt32 &)> 
isVoxelValidForPath
 This function is called to determine whether the path can pass though a given voxel.
std::function< void(float)> progressCallback
 This function is called by the AStarPathfinder to report on its progress in getting to the goal.

Detailed Description

template<typename VolumeType>
struct PolyVox::AStarPathfinderParams< VolumeType >

Provides a configuration for the AStarPathfinder.

This structure stores the AStarPathfinders configuration options, because this is simpler than providing a large number of get/set properties within the AStarPathfinder itself. In order to create an instance of this structure you must provide at least a volume, a start and end point, and a list to store the result. All the other option have sensible default values which can optionally be changed for more precise control over the pathfinder's behaviour.

See also:
AStarPathfinder

Definition at line 62 of file AStarPathfinder.h.


Constructor & Destructor Documentation

template<typename VolumeType>
PolyVox::AStarPathfinderParams< VolumeType >::AStarPathfinderParams ( VolumeType *  volData,
const Vector3DInt32 v3dStart,
const Vector3DInt32 v3dEnd,
std::list< Vector3DInt32 > *  listResult,
float  fHBias = 1.0,
uint32_t  uMaxNoOfNodes = 10000,
Connectivity  requiredConnectivity = TwentySixConnected,
std::function< bool(const VolumeType *, const Vector3DInt32 &)>  funcIsVoxelValidForPath = &aStarDefaultVoxelValidator,
std::function< void(float)>  funcProgressCallback = 0 
)
inline

Definition at line 66 of file AStarPathfinder.h.


Member Data Documentation

template<typename VolumeType>
Connectivity PolyVox::AStarPathfinderParams< VolumeType >::connectivity

The AStarPathfinder performs its search by examining the neighbours of each voxel it encounters.

This property controls the meaning of neighbour - e.g. whether two voxels must share a face, edge, or corner.

Definition at line 105 of file AStarPathfinder.h.

template<typename VolumeType>
Vector3DInt32 PolyVox::AStarPathfinderParams< VolumeType >::end

The end point for the pathfinding algorithm.

Definition at line 96 of file AStarPathfinder.h.

template<typename VolumeType>
float PolyVox::AStarPathfinderParams< VolumeType >::hBias

For each voxel the pathfinder tracks its distance to the start (known as g()) and estimates its distance to the end (known as h()).

Increasing or decreasing h() has an effect on the way the pathfinder behaves. If h() is an underestimate of the true distance then the pathfinder will act more like a greedy search - always finding the shortest path but taking longer to do so. If h() is an over estimate then the pathfinder will behave more like a best-first search - returning a potentially suboptimal path but finding it more quickly. The hBias is multiplied by the estimated h() value to control this behaviour.

Definition at line 115 of file AStarPathfinder.h.

template<typename VolumeType>
std::function<bool (const VolumeType*, const Vector3DInt32&)> PolyVox::AStarPathfinderParams< VolumeType >::isVoxelValidForPath

This function is called to determine whether the path can pass though a given voxel.

The default behaviour is specified by aStarDefaultVoxelValidator(), but users can specify thier own criteria if desired. For example, if you always want a path to follow a surface then you could check to ensure that the voxel above is empty and the voxel below is solid.

See also:
aStarDefaultVoxelValidator

Definition at line 129 of file AStarPathfinder.h.

template<typename VolumeType>
uint32_t PolyVox::AStarPathfinderParams< VolumeType >::maxNumberOfNodes

Volumes can be pretty huge (millions of voxels) and processing each one of these can take a long time.

In A* terminology each voxel is a node, and this property controls the maximum number of nodes that will be considered when finding the path, before giving up and throwing an exception because a path can't be found.

Definition at line 121 of file AStarPathfinder.h.

template<typename VolumeType>
std::function<void (float)> PolyVox::AStarPathfinderParams< VolumeType >::progressCallback

This function is called by the AStarPathfinder to report on its progress in getting to the goal.

The progress is reported by computing the distance from the closest node found so far to the end node, and comparing this with the distance from the start node to the end node. This progress value is guarenteed to never decrease, but it may stop increasing *for short periods of time. It may even stop increasing altogether if a path cannot be found.

Definition at line 136 of file AStarPathfinder.h.

template<typename VolumeType>
std::list<Vector3DInt32>* PolyVox::AStarPathfinderParams< VolumeType >::result

The resulting path will be stored as a series of points in this list.

Any existing contents will be cleared.

Definition at line 100 of file AStarPathfinder.h.

template<typename VolumeType>
Vector3DInt32 PolyVox::AStarPathfinderParams< VolumeType >::start

The start point for the pathfinding algorithm.

Definition at line 93 of file AStarPathfinder.h.

template<typename VolumeType>
VolumeType* PolyVox::AStarPathfinderParams< VolumeType >::volume

This is the volume through which the AStarPathfinder must find a path.

Definition at line 90 of file AStarPathfinder.h.


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