38 #ifndef _POTENTIAL_CALCULATOR_H 39 #define _POTENTIAL_CALCULATOR_H 48 virtual float calculatePotential(
float* potential,
unsigned char cost,
int n,
float prev_potential=-1){
49 if(prev_potential < 0){
51 float min_h = std::min( potential[n - 1], potential[n + 1] ),
52 min_v = std::min( potential[n -
nx_], potential[n +
nx_]);
53 prev_potential = std::min(min_h, min_v);
56 return prev_potential + cost;
PotentialCalculator(int nx, int ny)
virtual float calculatePotential(float *potential, unsigned char cost, int n, float prev_potential=-1)
int toIndex(int x, int y)
virtual void setSize(int nx, int ny)
Sets or resets the size of the map.