Review fix.

This commit is contained in:
Axel 2020-03-05 12:57:15 +01:00 committed by Marc Garcia Puig
parent bb8e3af4e4
commit c4bf8d3f58
1 changed files with 6 additions and 7 deletions

View File

@ -750,9 +750,10 @@ namespace road {
// =========================================================================== // ===========================================================================
// Checks whether the geometry is straight or not // Checks whether the geometry is straight or not
bool IsLineStraight(const Road &road, bool IsLaneStraight(const Lane &lane) {
const Lane &lane, Road *road = lane.GetRoad();
const element::RoadInfoGeometry* geometry) { auto *geometry = road->GetInfo<RoadInfoGeometry>(lane.GetDistance());
DEBUG_ASSERT(geometry != nullptr);
auto geometry_type = geometry->GetGeometry().GetType(); auto geometry_type = geometry->GetGeometry().GetType();
if (geometry_type != element::GeometryType::LINE) { if (geometry_type != element::GeometryType::LINE) {
return false; return false;
@ -769,7 +770,7 @@ namespace road {
return false; return false;
} }
} }
auto elevations = road.GetInfos<element::RoadInfoElevation>(); auto elevations = road->GetInfos<element::RoadInfoElevation>();
for (auto *elevation : elevations) { for (auto *elevation : elevations) {
if (abs(elevation->GetPolynomial().GetC()) > 0 || if (abs(elevation->GetPolynomial().GetC()) > 0 ||
abs(elevation->GetPolynomial().GetD()) > 0) { abs(elevation->GetPolynomial().GetD()) > 0) {
@ -852,14 +853,12 @@ namespace road {
auto current_waypoint = lane_start_waypoint; auto current_waypoint = lane_start_waypoint;
const Road &road = _data.GetRoad(current_waypoint.road_id);
const Lane &lane = GetLane(current_waypoint); const Lane &lane = GetLane(current_waypoint);
const auto *geometry = road.GetInfo<element::RoadInfoGeometry>(current_waypoint.s);
geom::Transform current_transform = ComputeTransform(current_waypoint); geom::Transform current_transform = ComputeTransform(current_waypoint);
// Save computation time in straight lines // Save computation time in straight lines
if (IsLineStraight(road, lane, geometry)) { if (IsLaneStraight(lane)) {
double delta_s = min_delta_s; double delta_s = min_delta_s;
double remaining_length = double remaining_length =
GetRemainingLength(lane, current_waypoint.s); GetRemainingLength(lane, current_waypoint.s);