| 37 | |
| 38 | template <class T> |
| 39 | T FindDirectionByAngle(std::vector<std::pair<double, T>> const & lowerBounds, double const angle) |
| 40 | { |
| 41 | ASSERT_GREATER_OR_EQUAL(angle, -180., (angle)); |
| 42 | ASSERT_LESS_OR_EQUAL(angle, 180., (angle)); |
| 43 | ASSERT(!lowerBounds.empty(), ()); |
| 44 | ASSERT(is_sorted(lowerBounds.rbegin(), lowerBounds.rend(), base::LessBy(&std::pair<double, T>::first)), ()); |
| 45 | |
| 46 | for (auto const & lower : lowerBounds) |
| 47 | if (angle >= lower.first) |
| 48 | return lower.second; |
| 49 | |
| 50 | ASSERT(false, ("The angle is not covered by the table. angle = ", angle)); |
| 51 | return T::None; |
| 52 | } |
| 53 | |
| 54 | CarDirection InvertDirection(CarDirection const dir) |
| 55 | { |
no test coverage detected