Compute an X x Y x Z grid to have 'num' grid cells, only gives a nice grid for numbers with even factors since we don't search for factors of the number, we just try dividing by two
| 165 | // only gives a nice grid for numbers with even factors since |
| 166 | // we don't search for factors of the number, we just try dividing by two |
| 167 | vec3i computeGrid(int num) |
| 168 | { |
| 169 | vec3i grid(1); |
| 170 | int axis = 0; |
| 171 | int divisor = 0; |
| 172 | while (computeDivisor(num, divisor)) { |
| 173 | grid[axis] *= divisor; |
| 174 | num /= divisor; |
| 175 | axis = (axis + 1) % 3; |
| 176 | } |
| 177 | if (num != 1) { |
| 178 | grid[axis] *= num; |
| 179 | } |
| 180 | return grid; |
| 181 | } |
no test coverage detected