13 static void oversample(std::vector<SPoint3> &s,
double tol)
15 std::vector<SPoint3> t;
16 for(std::size_t i = 1; i < s.size(); i++) {
20 int N = (int)(d / tol);
22 for(
int j = 1; j < N; j++) {
23 const double xi = (double)j / N;
24 t.push_back(p0 + (p1 - p0) * xi);
35 std::vector<SPoint3> pts;
39 std::vector<double> ts;
44 Msg::Error(
"Unknown curve in closestPointFinder");
47 index =
new ANNidx[1];
48 dist =
new ANNdist[1];
49 zeronodes = annAllocPts(pts.size(), 3);
50 for(std::size_t k = 0; k < pts.size(); k++) {
51 zeronodes[k][0] = pts[k].x();
52 zeronodes[k][1] = pts[k].y();
53 zeronodes[k][2] = pts[k].z();
55 kdtree =
new ANNkd_tree(zeronodes, pts.size(), 3);
57 Msg::Error(
"Gmsh should be compiled with ANN to support closestPointFinder");
64 if(kdtree)
delete kdtree;
65 if(zeronodes) annDeallocPts(zeronodes);
74 double xyz[3] = {p.
x(), p.
y(), p.
z()};
75 kdtree->annkSearch(xyz, 1, index, dist);
76 return SPoint3(zeronodes[index[0]][0], zeronodes[index[0]][1],
77 zeronodes[index[0]][2]);