(aabb, resolution)
| 2 | |
| 3 | |
| 4 | def sample_grid_points_aabb(aabb, resolution): |
| 5 | # aabb: (6, ) |
| 6 | # resolution: int |
| 7 | # return: (Nx, Ny, Nz, 3) |
| 8 | aabb_min, aabb_max = aabb[:3], aabb[3:] |
| 9 | aabb_size = aabb_max - aabb_min |
| 10 | resolutions = (resolution * aabb_size / aabb_size.max()).astype(np.int32) |
| 11 | |
| 12 | xs = np.linspace(0.5, resolutions[0] - 0.5, resolutions[0]) / resolutions[0] * aabb_size[0] + aabb_min[0] |
| 13 | ys = np.linspace(0.5, resolutions[1] - 0.5, resolutions[1]) / resolutions[1] * aabb_size[1] + aabb_min[1] |
| 14 | zs = np.linspace(0.5, resolutions[2] - 0.5, resolutions[2]) / resolutions[2] * aabb_size[2] + aabb_min[2] |
| 15 | grid_points = np.stack(np.meshgrid(xs, ys, zs, indexing='ij'), axis=-1) |
| 16 | return grid_points |
| 17 | |
| 18 | |
| 19 | def normalize_aabb(v, reso, enlarge_scale=1.03, mult=8): |
no outgoing calls
no test coverage detected