| 76 | } |
| 77 | |
| 78 | void NearestEdgeFinder::MakeResult(vector<EdgeProjectionT> & res, size_t maxCountFeatures) |
| 79 | { |
| 80 | sort(m_candidates.begin(), m_candidates.end(), |
| 81 | [](Candidate const & r1, Candidate const & r2) { return r1.m_squaredDist < r2.m_squaredDist; }); |
| 82 | |
| 83 | res.clear(); |
| 84 | res.reserve(maxCountFeatures); |
| 85 | |
| 86 | for (Candidate const & candidate : m_candidates) |
| 87 | { |
| 88 | CandidateToResult(candidate, maxCountFeatures, res); |
| 89 | if (res.size() >= maxCountFeatures) |
| 90 | return; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | void NearestEdgeFinder::CandidateToResult(Candidate const & candidate, size_t maxCountFeatures, |
| 95 | vector<EdgeProjectionT> & res) const |