Gets the index of a vertex, adding it to newVertexArray if necessary.
125 int closestIndex = -1;
126 double distanceSquared =
inf();
132 const List& list =
grid[ix][iy][iz];
134 for (
int i = 0; i < list.size(); ++i) {
137 if (d < distanceSquared) {
139 closestIndex = list[i];
156 Set<List*> neighbors;
158 for (
float dx = -1; dx <= +1; ++dx) {
159 for (
float dy = -1; dy <= +1; ++dy) {
160 for (
float dz = -1; dz <= +1; ++dz) {
162 toGridCoords(vertex + Vector3(dx, dy, dz) * radius, ix, iy, iz);
163 neighbors.insert(&(
grid[ix][iy][iz]));
168 Set<List*>::Iterator neighbor(neighbors.begin());
169 Set<List*>::Iterator none(neighbors.end());
171 while (neighbor != none) {
172 (*neighbor)->append(newIndex);
double inf()
Definition: g3dmath.cpp:40
Array< Vector3 > & newVertexArray
Definition: MeshAlgWeld.cpp:38
void toGridCoords(Vector3 v, int &x, int &y, int &z) const
Definition: MeshAlgWeld.cpp:115
const float radius
Definition: MeshAlgWeld.cpp:43
Array< int > List
Definition: MeshAlgWeld.cpp:31
List grid[GRID_RES][GRID_RES][GRID_RES]
Definition: MeshAlgWeld.cpp:35