| 124 | } |
| 125 | |
| 126 | double GetBicycleClimbPenalty(EdgeEstimator::Purpose purpose, double tangent, geometry::Altitude altitudeM) |
| 127 | { |
| 128 | double constexpr kMinPenalty = 1.0; |
| 129 | double const impact = tangent >= 0.0 ? 1.0 : 0.35; |
| 130 | |
| 131 | if (altitudeM >= kMountainSicknessAltitudeM) |
| 132 | return kMinPenalty + 50.0 * fabs(tangent) * impact; |
| 133 | |
| 134 | // By VNG: This approach is strange at least because it always returns penalty > 1 (even for downhill) |
| 135 | /* |
| 136 | tangent = fabs(tangent); |
| 137 | // ETA coefficients are calculated in https://github.com/mapsme/omim-scripts/pull/22 |
| 138 | auto const penalty = purpose == EdgeEstimator::Purpose::Weight |
| 139 | ? 10.0 * tangent + 26.0 * tangent * tangent |
| 140 | : 8.8 * tangent + 6.51 * tangent * tangent; |
| 141 | |
| 142 | return kMinPenalty + penalty * impact; |
| 143 | */ |
| 144 | |
| 145 | // https://web.tecnico.ulisboa.pt/~rosamfelix/gis/declives/SpeedSlopeFactor.html |
| 146 | double const slope = tangent * 100; |
| 147 | |
| 148 | double factor; |
| 149 | if (slope < -30) |
| 150 | factor = 1.5; |
| 151 | else if (slope < 0) |
| 152 | { |
| 153 | // Min factor (max speed) will be at slope = -13. |
| 154 | factor = 1 + 2 * 0.7 / 13.0 * slope + 0.7 / 169 * slope * slope; |
| 155 | } |
| 156 | else if (slope <= 20) |
| 157 | factor = 1 + slope * slope / 49; |
| 158 | else |
| 159 | factor = 10.0; |
| 160 | return factor; |
| 161 | } |
| 162 | |
| 163 | // EdgeEstimator ----------------------------------------------------------------------------------- |
| 164 | EdgeEstimator::EdgeEstimator(VehicleType vehicleType, double maxWeightSpeedKMpH, SpeedKMpH const & offroadSpeedKMpH, |
no outgoing calls