35 const scalar mergeTol,
42 point compareOrigin = origin;
44 if (origin ==
point(VGREAT, VGREAT, VGREAT))
48 compareOrigin =
sum(points)/points.
size();
65 const scalar mergeTolSqr =
sqr(mergeTol);
70 bool hasMerged =
false;
76 label pointI = sortedMagSqr.
indices()[0];
77 pointMap[pointI] = newPointI;
78 newPoints[newPointI++] = points[pointI];
81 for (label sortI = 1; sortI < sortedMagSqr.
size(); sortI++)
84 label pointI = sortedMagSqr.
indices()[sortI];
87 label equalPointI = -1;
91 label prevSortI = sortI - 1;
95 sortedMagSqr[prevSortI]
101 label prevPointI = sortedMagSqr.
indices()[prevSortI];
103 if (
magSqr(points[pointI] - points[prevPointI]) <= mergeTolSqr)
106 equalPointI = prevPointI;
113 if (equalPointI != -1)
116 pointMap[pointI] = pointMap[equalPointI];
122 Pout<<
"Foam::mergePoints : Merging points "
123 << pointI <<
" and " << equalPointI
124 <<
" with coordinates:" << points[pointI]
125 <<
" and " << points[equalPointI]
132 pointMap[pointI] = newPointI;
133 newPoints[newPointI++] = points[pointI];