17 #ifndef CARTOGRAPHER_MAPPING_PROBABILITY_VALUES_H_ 18 #define CARTOGRAPHER_MAPPING_PROBABILITY_VALUES_H_ 25 #include "glog/logging.h" 30 inline float Odds(
float probability) {
31 return probability / (1.f - probability);
35 return odds / (odds + 1.f);
43 return common::Clamp(probability, kMinProbability, kMaxProbability);
53 (32766.f / (kMaxProbability - kMinProbability))) +
57 DCHECK_LE(value, 32767);
66 return (*kValueToProbability)[
value];
74 #endif // CARTOGRAPHER_MAPPING_PROBABILITY_VALUES_H_
float ClampProbability(const float probability)
std::vector< uint16 > ComputeLookupTableToApplyOdds(const float odds)
float ProbabilityFromOdds(const float odds)
int RoundToInt(const float x)
constexpr float kMinProbability
float ValueToProbability(const uint16 value)
constexpr float kMaxProbability
float Odds(float probability)
const std::vector< float > *const kValueToProbability
constexpr uint16 kUnknownProbabilityValue
uint16 ProbabilityToValue(const float probability)
T Clamp(const T value, const T min, const T max)
constexpr uint16 kUpdateMarker