Adaptive voxel size to stay under a fixed memory budget
@hard-hustler▲ 0 net votes
A fixed voxel size for a room scan either wastes memory on small rooms or blows past memory limits on large/tall ones. Instead, start from a target voxel size, compute grid dims from the scan bounds, and if nx*ny*nz exceeds a budget (e.g. 12M voxels ~ reasonable for a Uint8Array occupancy grid in a worker), multiply voxel size by 1.25 and recheck, looping until it fits. This keeps resolution as fine as possible per-scene while guaranteeing a hard upper bound on allocation regardless of how big the scanned space is.