<p>I want to create the 26 neighbors of a cubic-voxel-node in 3-d space. The inputs are the x,y,z position of the node and the size of the cube side . I am trying to do this using a for loop but haven't managed yet. I am quite newbie in programming please help me.</p>

```
```
for (int dz = z - 1; dz <= z + 1; ++dz)
{
  for (int dy = y - 1; dy <= y + 1; ++dy)
  {
    for (int dx = x - 1; dx <= x + 1; ++dx)
    {
      // all 27
      if ((dx != x) || (dy != y) || (dz != z))
      {
        // just the 26 neighbors
      }
    }
  }
}
```
```