| 61 | |
| 62 | template <class CalcSpeed> |
| 63 | double CalcClimbSegment(EdgeEstimator::Purpose purpose, Segment const & segment, RoadGeometry const & road, |
| 64 | CalcSpeed && calcSpeed) |
| 65 | { |
| 66 | double const distance = road.GetDistance(segment.GetSegmentIdx()); |
| 67 | double speedMpS = GetSpeedMpS(purpose, segment, road); |
| 68 | |
| 69 | static double constexpr kSmallDistanceM = 1; // we have altitude threshold is 0.5m |
| 70 | if (distance > kSmallDistanceM && !IsTransit(road.GetHighwayType())) |
| 71 | { |
| 72 | LatLonWithAltitude const & from = road.GetJunction(segment.GetPointId(false /* front */)); |
| 73 | LatLonWithAltitude const & to = road.GetJunction(segment.GetPointId(true /* front */)); |
| 74 | |
| 75 | ASSERT(to.GetAltitude() != geometry::kInvalidAltitude && from.GetAltitude() != geometry::kInvalidAltitude, ()); |
| 76 | auto const altitudeDiff = to.GetAltitude() - from.GetAltitude(); |
| 77 | |
| 78 | if (altitudeDiff != 0) |
| 79 | { |
| 80 | speedMpS = calcSpeed(speedMpS, altitudeDiff / distance, to.GetAltitude()); |
| 81 | ASSERT_GREATER(speedMpS, 0.0, (segment)); |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | return distance / speedMpS; |
| 86 | } |
| 87 | } // namespace |
| 88 | |
| 89 | double GetPedestrianClimbPenalty(EdgeEstimator::Purpose purpose, double tangent, geometry::Altitude altitudeM) |
no test coverage detected