fix problem at the source

This commit is contained in:
Moritz Kobitzsch
2016-12-13 11:48:21 +01:00
committed by Patrick Niklaus
parent 1b51163b1d
commit 67ce19cb14
4 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -211,7 +211,7 @@ util::json::Object makeIntersection(const guidance::Intersection &intersection)
intersection.bearings.begin(),
intersection.bearings.end(),
std::back_inserter(bearings.values),
[](const double bearing) -> util::json::Value { return std::fmod(bearing, 360); });
[](const double bearing) -> util::json::Value { BOOST_ASSERT(bearing != 360.0); return std::fmod(bearing, 360); });
entry.values.reserve(intersection.entry.size());
std::transform(intersection.entry.begin(),
+1 -1
View File
@@ -56,7 +56,7 @@ DiscreteBearing BearingClass::getDiscreteBearing(const double bearing)
{
BOOST_ASSERT(0. <= bearing && bearing <= 360.);
auto shifted_bearing = (bearing + 0.5 * discrete_step_size);
if (shifted_bearing > 360.)
if (shifted_bearing >= 360.)
shifted_bearing -= 360;
return static_cast<DiscreteBearing>(shifted_bearing / discrete_step_size);
}
+1 -1
View File
@@ -14,7 +14,7 @@ constexpr double bearing_scale = 360.0 / 256.0;
// discretizes a bearing into distinct units of 1.4 degrees
TurnBearing::TurnBearing(const double value) : bearing(value / bearing_scale)
{
BOOST_ASSERT_MSG(value >= 0 && value <= 360.0, "Bearing value needs to be between 0 and 360");
BOOST_ASSERT_MSG(value >= 0 && value < 360.0, "Bearing value needs to be between 0 and 360 (exclusive)");
}
double TurnBearing::Get() const { return bearing * bearing_scale; }