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

Method IsAlmostCodirectional

libs/routing/index_router.cpp:225–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

223}
224
225bool IndexRouter::BestEdgeComparator::IsAlmostCodirectional(Edge const & edge) const
226{
227 CHECK(IsDirectionValid(), ());
228
229 auto const edgeDirection = edge.GetDirection();
230 if (edgeDirection.IsAlmostZero())
231 return false;
232
233 double const cosAng = m2::DotProduct(m_direction.Normalize(), edgeDirection.Normalize());
234 // Note. acos(0.97) ≈ 14 degrees.
235 double constexpr kMinCosAngForAlmostCodirectionalVectors = 0.97;
236 return cosAng >= kMinCosAngForAlmostCodirectionalVectors;
237}
238
239double IndexRouter::BestEdgeComparator::GetSquaredDist(Edge const & edge) const
240{

Callers 1

Calls 4

IsAlmostZeroMethod · 0.80
DotProductFunction · 0.50
GetDirectionMethod · 0.45
NormalizeMethod · 0.45

Tested by

no test coverage detected