geometry changes/fixes/new features
new grid walkers + fixes new test-cases worked on step/and turn detection android offline-data-reader worked on vap-grouping
This commit is contained in:
10
misc/KNN.h
10
misc/KNN.h
@@ -94,13 +94,21 @@ public:
|
||||
}
|
||||
|
||||
/** get the distance to the element nearest to the given point */
|
||||
float getNearestDistance(const std::initializer_list<Scalar> lst) {
|
||||
float getNearestDistance(const std::initializer_list<Scalar> lst) const {
|
||||
size_t idx;
|
||||
float distSquared;
|
||||
tree.knnSearch(lst.begin(), 1, &idx, &distSquared);
|
||||
return std::sqrt(distSquared);
|
||||
}
|
||||
|
||||
/** get the distance to the element nearest to the given point */
|
||||
float getNearestDistanceWithinRadius(const std::initializer_list<Scalar> lst, const float maxRadius) const {
|
||||
std::vector<std::pair<size_t, float>> res;
|
||||
tree.radiusSearch(lst.begin(), maxRadius*maxRadius, res, nanoflann::SearchParams());
|
||||
if (res.empty()) {return NAN;}
|
||||
return std::sqrt(res[0].second);
|
||||
}
|
||||
|
||||
void get(const Scalar* point, const int numNeighbors, size_t* indices, float* squaredDist) {
|
||||
|
||||
// find k-nearest-neighbors
|
||||
|
||||
Reference in New Issue
Block a user