void test_uniform(std::string name, unsigned int n, double eps) { set_log_level(SILENT); set_check_level(NONE); BoundingBox3D bb(Vector3D(0, 0, 0), Vector3D(10, 10, 10)); Vector3Ds pts; for (unsigned int i = 0; i < n; ++i) { pts.push_back(get_random_vector_in(bb)); } KNN knn(pts.begin(), pts.end()); test(name + " uniform", pts, knn, eps); }
Vector3Ds read_pts(base::TextInput oin) { std::istream &in= oin; Vector3Ds ret; while (true) { char buf[2000]; in.getline(buf, 2000); if (!in) break;; if (buf[0]=='#') continue; std::istringstream iss(buf); IMP::Float x,y,z; iss >> x >> y >> z; if (!iss) { throw IMP::base::ValueException((std::string("Unable to parse line ") + buf).c_str()); } Vector3D v(x,y,z); ret.push_back(v); } return ret; }