35 #ifndef NAV_GRID_PUB_SUB_COST_INTERPRETATION_H
36 #define NAV_GRID_PUB_SUB_COST_INTERPRETATION_H
49 template<
typename NumericType,
typename IntegralType>
51 const std::vector<NumericType>& cost_interpretation_table)
53 unsigned int index =
static_cast<unsigned int>(original_value);
54 if (index < cost_interpretation_table.size())
56 return cost_interpretation_table[index];
60 return original_value;
67 template<
typename IntegralType>
69 const std::vector<IntegralType>& cost_interpretation_table)
87 template<
typename NumericType>
88 inline unsigned char interpretValue(
const NumericType value,
const NumericType min_value,
89 const NumericType denominator,
const NumericType unknown_value)
91 if (value == unknown_value)
97 double ratio = (value - min_value) / denominator;
98 return static_cast<unsigned char>(ratio * 100.0);
104 #endif // NAV_GRID_PUB_SUB_COST_INTERPRETATION_H