MCPcopy Create free account
hub / github.com/comaps/comaps / FindDirectionByAngle

Function FindDirectionByAngle

libs/routing/turns_generator_utils.cpp:39–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37
38template <class T>
39T 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
54CarDirection InvertDirection(CarDirection const dir)
55{

Callers 3

RightmostDirectionFunction · 0.85
IntermediateDirectionFunction · 0.85

Calls 5

ASSERTFunction · 0.85
LessByFunction · 0.85
rbeginMethod · 0.80
rendMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected