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

Function GetConnectionAngleAndDistance

libs/search/house_detector.cpp:135–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135pair<double, double> GetConnectionAngleAndDistance(bool & isBeg, Street const * s1, Street const * s2)
136{
137 m2::PointD const & p1 = isBeg ? s1->m_points.front() : s1->m_points.back();
138 m2::PointD const & p0 = isBeg ? s1->m_points[1] : s1->m_points[s1->m_points.size() - 2];
139
140 double const d0 = p1.SquaredLength(s2->m_points.front());
141 double const d2 = p1.SquaredLength(s2->m_points.back());
142 isBeg = (d0 < d2);
143 m2::PointD const & p2 = isBeg ? s2->m_points[1] : s2->m_points[s2->m_points.size() - 2];
144
145 return make_pair(ang::GetShortestDistance(ang::AngleTo(p0, p1), ang::AngleTo(p1, p2)), min(d0, d2));
146}
147
148class HasSecond
149{

Callers 1

FindConnectionMethod · 0.85

Calls 6

GetShortestDistanceFunction · 0.85
AngleToFunction · 0.85
frontMethod · 0.80
backMethod · 0.80
SquaredLengthMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected