32 #ifndef __NABE_TEST_HELPERS_H 33 #define __NABE_TEST_HELPERS_H 51 ifstream ifs(fileName);
54 cerr <<
"Cannot open file "<< fileName << endl;
65 ifs.getline(line,
sizeof(line));
66 line[
sizeof(line)-1] = 0;
68 char *token = strtok(line,
" \t,;");
73 data.push_back(atof(token));
74 token = strtok(NULL,
" \t,;");
79 return Matrix::Map(&data[0], dim, data.size() / dim);
88 VectorT
q = d.col(i % d.cols());
90 for (
int j = 0; j < q.size(); ++j)
92 absBound /= (-method);
95 q.array() += absBound;
97 q.array() -= absBound;
100 q.cwise() += absBound;
102 q.cwise() -= absBound;
109 for (
int j = 0; j <
q.size(); ++j)
121 MatrixT
q(d.rows(), itCount);
122 for (
int i = 0; i < itCount; ++i)
123 q.col(i) = createQuery<T>(d, *
nns, i, method);
130 using Clock = std::chrono::high_resolution_clock;
131 using Time = Clock::time_point;
137 using namespace std::chrono;
138 return duration_cast<duration<double>>(curTime() - _start_time).count();
148 #endif // __NABE_TEST_HELPERS_H
Nearest neighbour search interface, templatized on scalar type.
NearestNeighbourSearch< T >::Vector createQuery(const typename NearestNeighbourSearch< T >::Matrix &d, const NearestNeighbourSearch< T > &kdt, const int i, const int method)
NNSNabo::SearchType SearchType
const Vector maxBound
the high bound of the search space (axis-aligned bounding box)
const Vector minBound
the low bound of the search space (axis-aligned bounding box)
std::chrono::high_resolution_clock Clock
NearestNeighbourSearch< T >::Matrix load(const char *fileName)