MCPcopy Create free account
hub / github.com/comaps/comaps / Uint32ToDouble

Function Uint32ToDouble

libs/coding/point_coding.cpp:40–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40double Uint32ToDouble(uint32_t x, double min, double max, uint8_t coordBits)
41{
42 ASSERT_LESS_OR_EQUAL(min, max, ());
43
44 double const coordSize = CoordSize(coordBits);
45 auto const d = min + static_cast<double>(x) * (max - min) / coordSize;
46
47 // It doesn't work now because of fancy serialization of m2::DiamondBox.
48 /// @todo Check PathsThroughLayers search test. Refactor CitiesBoundariesSerDes.
49 // ASSERT_LESS_OR_EQUAL(x, coordSize, (d, min, max, coordBits));
50
51 // It doesn't work because of possible floating errors.
52 // ASSERT(d >= min && d <= max, (d, x, min, max, coordBits));
53
54 return math::Clamp(d, min, max);
55}
56
57m2::PointU PointDToPointU(double x, double y, uint8_t coordBits)
58{

Callers 11

ReadMethod · 0.85
ParseIntermediateInfoMethod · 0.85
PointUToPointDFunction · 0.85
operator()Method · 0.85
operator()Method · 0.85
operator()Method · 0.85
ReadMethod · 0.85
DeserializeMethod · 0.85
DeserializeSpeedCameraFunction · 0.85

Calls 2

CoordSizeFunction · 0.85
ClampFunction · 0.85

Tested by

no test coverage detected