estar::Grid Class Reference

#include <Grid.hpp>

List of all members.

Public Types

enum  neighborhood_t { FOUR, EIGHT, SIX }

Public Member Functions

 Grid (neighborhood_t neighborhood)
 You have to call Init() before actually using the Grid instance, otherwise you'll get segfaults.
 Grid (ssize_t xbegin, ssize_t xend, ssize_t ybegin, ssize_t yend, neighborhood_t neighborhood, double meta)
 Also calls Init(), see the comments there.
void Init (ssize_t xbegin, ssize_t xend, ssize_t ybegin, ssize_t yend, double meta)
 Allocate memory for the grid and initialize it (set its meta, connect to neighbors).
size_t AddRange (ssize_t xbegin, ssize_t xend, ssize_t ybegin, ssize_t yend, double meta, Algorithm &algo, Kernel const &kernel)
 Makes sure that the required range of indices is available, where (xend, yend) is the ONE-PAST-end marker for the X- and Y- directions.
bool AddNode (ssize_t ix, ssize_t iy, double meta, Algorithm &algo, Kernel const &kernel)
 If (ix, iy) is already in the grid, simply call Algorithm::SetMeta().
ssize_t GetXBegin () const
ssize_t GetXEnd () const
ssize_t GetYBegin () const
ssize_t GetYEnd () const
boost::shared_ptr< GridNode
const > 
GetNode (ssize_t ix, ssize_t iy) const
 A direct but slightly unsafe way of accessing a GridNode.
boost::shared_ptr< GridCSpace
const > 
GetCSpace () const
boost::shared_ptr< GridCSpaceGetCSpace ()
int ComputeGradient (ssize_t ix, ssize_t iy, double &gradx, double &grady) const
 
Returns:
-1: no such node.

bool ComputeGradient (boost::shared_ptr< GridNode const > node, double &gradx, double &grady) const
 
Returns:
true if there was information for both the X- and Y- directions.

int ComputeStableScaledGradient (ssize_t ix, ssize_t iy, double stepsize, double &gx, double &gy, double &dx, double &dy) const
 
Returns:
-1: no such node.

int ComputeStableScaledGradient (boost::shared_ptr< GridNode const > node, double stepsize, double &gx, double &gy, double &dx, double &dy) const
 
Returns:
0: success.

neighborhood_t GetNeighborhood () const

Private Types

typedef GridCSpace::vertex_data_t vertex_data_t
typedef flexgrid< vertex_data_tflexgrid_t
typedef std::vector< offsetnbor_offset_t

Private Member Functions

vertex_data_t DoAddNode (ssize_t ix, ssize_t iy, double meta)
 Blindly allocate a new node and add it to the flexgrid, hooking it up with its neighbors and initializing its meta.
void InitNborStuff ()

Private Attributes

neighborhood_t const m_neighborhood
nbor_offset_t m_nbor_offset
boost::shared_ptr< flexgrid_tm_flexgrid
boost::shared_ptr< GridCSpacem_cspace

Classes

struct  offset


Member Typedef Documentation

typedef GridCSpace::vertex_data_t estar::Grid::vertex_data_t [private]

typedef flexgrid<vertex_data_t> estar::Grid::flexgrid_t [private]

typedef std::vector<offset> estar::Grid::nbor_offset_t [private]


Member Enumeration Documentation

enum estar::Grid::neighborhood_t

Enumerator:
FOUR 
EIGHT 
SIX 


Constructor & Destructor Documentation

estar::Grid::Grid ( neighborhood_t  neighborhood  )  [explicit]

You have to call Init() before actually using the Grid instance, otherwise you'll get segfaults.

estar::Grid::Grid ( ssize_t  xbegin,
ssize_t  xend,
ssize_t  ybegin,
ssize_t  yend,
neighborhood_t  neighborhood,
double  meta 
)

Also calls Init(), see the comments there.


Member Function Documentation

void estar::Grid::Init ( ssize_t  xbegin,
ssize_t  xend,
ssize_t  ybegin,
ssize_t  yend,
double  meta 
)

Allocate memory for the grid and initialize it (set its meta, connect to neighbors).

This is not intended for ranges that do not include 0, so all bets are off if you use it that way.

size_t estar::Grid::AddRange ( ssize_t  xbegin,
ssize_t  xend,
ssize_t  ybegin,
ssize_t  yend,
double  meta,
Algorithm algo,
Kernel const &  kernel 
)

Makes sure that the required range of indices is available, where (xend, yend) is the ONE-PAST-end marker for the X- and Y- directions.

That is to say, after this call there is guaranteed to be a GridNode at [xend-1, yend-1] but not beyond that.

All newly created GridNode instances are initialized by calling AddNode(). The method does not modify any prior existing nodes in the given range of indices, except for adding neighborhood edges where appropriate.

Note:
This method calls Algorithm::AddVertex() in order to properly register any new nodes with the wavefront queue.
Returns:
The number of added vertices.

bool estar::Grid::AddNode ( ssize_t  ix,
ssize_t  iy,
double  meta,
Algorithm algo,
Kernel const &  kernel 
)

If (ix, iy) is already in the grid, simply call Algorithm::SetMeta().

Otherwise, add a new GridNode instance, hook it up via edges to its neighbors, initialize its meta, and call Algorithm::AddVertex().

Note:
All freshly added nodes get assigned a value of infinity.
Returns:
true if a new GridNode was allocated and inserted into the grid.

ssize_t estar::Grid::GetXBegin (  )  const

ssize_t estar::Grid::GetXEnd (  )  const

ssize_t estar::Grid::GetYBegin (  )  const

ssize_t estar::Grid::GetYEnd (  )  const

boost::shared_ptr< GridNode const > estar::Grid::GetNode ( ssize_t  ix,
ssize_t  iy 
) const

A direct but slightly unsafe way of accessing a GridNode.

If you want to iterate over all nodes, you should call GetCSpace() and use BaseCSpace::begin() which is much more decoupled from the grid implementation.

Note:
There is no guarantee that the entire range (GetXBegin(), GetXEnd(), GetYBegin(), GetYEnd()) is covered, so you might get null pointers.
Returns:
Can return a null pointer if there is no node residing at that index.

boost::shared_ptr<GridCSpace const> estar::Grid::GetCSpace (  )  const [inline]

boost::shared_ptr<GridCSpace> estar::Grid::GetCSpace (  )  [inline]

int estar::Grid::ComputeGradient ( ssize_t  ix,
ssize_t  iy,
double &  gradx,
double &  grady 
) const

Returns:
-1: no such node.

0: success. 1: (partially) incomplete information.

bool estar::Grid::ComputeGradient ( boost::shared_ptr< GridNode const >  node,
double &  gradx,
double &  grady 
) const

Returns:
true if there was information for both the X- and Y- directions.

int estar::Grid::ComputeStableScaledGradient ( ssize_t  ix,
ssize_t  iy,
double  stepsize,
double &  gx,
double &  gy,
double &  dx,
double &  dy 
) const

Returns:
-1: no such node.

0: success. 1: (partially) incomplete information. 2: gradient was too small, replaced with heuristic.

Parameters:
stepsize  wanted length of (dx, dy)
gx  only valid if return 0
gy  only valid if return 0
dx  always valid
dy  always valid

int estar::Grid::ComputeStableScaledGradient ( boost::shared_ptr< GridNode const >  node,
double  stepsize,
double &  gx,
double &  gy,
double &  dx,
double &  dy 
) const

Returns:
0: success.

1: (partially) incomplete information. 2: gradient was too small, replaced with heuristic.

neighborhood_t estar::Grid::GetNeighborhood (  )  const [inline]

Grid::vertex_data_t estar::Grid::DoAddNode ( ssize_t  ix,
ssize_t  iy,
double  meta 
) [private]

Blindly allocate a new node and add it to the flexgrid, hooking it up with its neighbors and initializing its meta.

void estar::Grid::InitNborStuff (  )  [private]


Member Data Documentation

neighborhood_t const estar::Grid::m_neighborhood [private]

nbor_offset_t estar::Grid::m_nbor_offset [private]

boost::shared_ptr<flexgrid_t> estar::Grid::m_flexgrid [private]

boost::shared_ptr<GridCSpace> estar::Grid::m_cspace [private]


The documentation for this class was generated from the following files:
doxygen SourceForge.net Logo
E* Interpolated Graph Replanner Wed Dec 12 18:55:50 2007