Generates a 2D grid of points evenly spaced in [0,1]x[0,1].
(n_per_side: int)
| 177 | |
| 178 | |
| 179 | def build_point_grid(n_per_side: int) -> np.ndarray: |
| 180 | """Generates a 2D grid of points evenly spaced in [0,1]x[0,1].""" |
| 181 | offset = 1 / (2 * n_per_side) |
| 182 | points_one_side = np.linspace(offset, 1 - offset, n_per_side) |
| 183 | points_x = np.tile(points_one_side[None, :], (n_per_side, 1)) |
| 184 | points_y = np.tile(points_one_side[:, None], (1, n_per_side)) |
| 185 | points = np.stack([points_x, points_y], axis=-1).reshape(-1, 2) |
| 186 | return points |
| 187 | |
| 188 | |
| 189 | def build_all_layer_point_grids( |
no outgoing calls
no test coverage detected