Returns the center coordinates of each cell of a 3D grid with resolution^3 cells, that is placed in the unit-cube. If clip_sphere it True it drops the "corner" cells that lie outside the unit-sphere.
(resolution, clip_sphere=False)
| 11 | yield l[i:i + n] |
| 12 | |
| 13 | def unit_cube_grid_point_cloud(resolution, clip_sphere=False): |
| 14 | '''Returns the center coordinates of each cell of a 3D grid with resolution^3 cells, |
| 15 | that is placed in the unit-cube. |
| 16 | If clip_sphere it True it drops the "corner" cells that lie outside the unit-sphere. |
| 17 | ''' |
| 18 | grid = np.ndarray((resolution, resolution, resolution, 3), np.float32) |
| 19 | spacing = 1.0 / float(resolution - 1) |
| 20 | for i in range(resolution): |
| 21 | for j in range(resolution): |
| 22 | for k in range(resolution): |
| 23 | grid[i, j, k, 0] = i * spacing - 0.5 |
| 24 | grid[i, j, k, 1] = j * spacing - 0.5 |
| 25 | grid[i, j, k, 2] = k * spacing - 0.5 |
| 26 | |
| 27 | if clip_sphere: |
| 28 | grid = grid.reshape(-1, 3) |
| 29 | grid = grid[np.linalg.norm(grid, axis=1) <= 0.5] |
| 30 | |
| 31 | return grid, spacing |
| 32 | |
| 33 | def minimum_mathing_distance(sample_pcs, ref_pcs, batch_size, normalize=True, sess=None, verbose=False, use_sqrt=False, |
| 34 | use_EMD=False): |
no outgoing calls
no test coverage detected