I would like cell indices of a contiguous (box-shaped) area area in a 3d grid, i.e. a 3d set {iMin…iMax}×{jMin…jMax}×{kMin…kMax}
. The naive approach would be:
for(int i=iMin; i<=iMax; i++){
for(int j=jMin; j<=jMax; j++){
for(int k=kMin; k<=kMax; k++){
// ...
}
}
}
Is there a less verbose way to do that, without nested loops?
(I am in c++11 and have a Vector3i
class for coordinates. I can use any boost library, also.)