| 205 | }; |
| 206 | |
| 207 | bool is_finalized(const F64 xmin, const F64 ymin, const F64 zmin, const F64 xmax, const F64 ymax, const F64 zmax) |
| 208 | { |
| 209 | U32 count = 0; |
| 210 | |
| 211 | I32 startx = I32_FLOOR((xmin - this->xmin) / xres); |
| 212 | I32 starty = I32_FLOOR((this->ymax - ymax) / yres); |
| 213 | I32 startz = I32_FLOOR((zmin - this->zmin) / zres); |
| 214 | I32 endx = I32_CEIL((xmax - this->xmin) / xres); |
| 215 | I32 endy = I32_CEIL((this->ymax - ymin) / yres); |
| 216 | I32 endz = I32_CEIL((zmax - this->zmin) / zres); |
| 217 | |
| 218 | startx = MAX2(startx, 0); |
| 219 | starty = MAX2(starty, 0); |
| 220 | startz = MAX2(startz, 0); |
| 221 | endx = MIN2(endx, ncols - 1); |
| 222 | endy = MIN2(endy, nrows - 1); |
| 223 | endz = MIN2(endz, nlays - 1); |
| 224 | |
| 225 | I32 cell; |
| 226 | for (I32 col = startx; col <= endx; col++) |
| 227 | { |
| 228 | for (I32 row = starty; row <= endy; row++) |
| 229 | { |
| 230 | for (I32 lay = startz; lay <= endz; lay++) |
| 231 | { |
| 232 | cell = lay * nrows * ncols + row * ncols + col; |
| 233 | count += grid[cell]; |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | |
| 238 | return count == 0; |
| 239 | }; |
| 240 | }; |
| 241 | |
| 242 | struct VoxelRecord |