// Reduces the size of the given shape by the given factor. static VoxelSet <bool> ReduceShape(VoxelSet <bool> shape, int factor) { Vec3i size = Vec3i.Max(shape.Size / factor, new Vec3i(1)); Debug.Log("Old size: " + shape.Size + " New size: " + size); VoxelSet <bool> reducedShape = new VoxelSet <bool>(size); shape.Apply((v, idx) => { Vec3i targetIdx = Vec3i.Min(size - 1, idx / factor); reducedShape[targetIdx] = reducedShape[targetIdx] || v; }); return(reducedShape); }