(bound_min, bound_max, resolution, threshold, query_func, use_sdf = False)
| 177 | |
| 178 | |
| 179 | def extract_geometry(bound_min, bound_max, resolution, threshold, query_func, use_sdf = False): |
| 180 | #print('threshold: {}'.format(threshold)) |
| 181 | u = extract_fields(bound_min, bound_max, resolution, query_func) |
| 182 | if use_sdf: |
| 183 | u = - 1.0 *u |
| 184 | |
| 185 | #print(u.mean(), u.max(), u.min(), np.percentile(u, 50)) |
| 186 | |
| 187 | vertices, triangles = mcubes.marching_cubes(u, threshold) |
| 188 | |
| 189 | b_max_np = bound_max.detach().cpu().numpy() |
| 190 | b_min_np = bound_min.detach().cpu().numpy() |
| 191 | |
| 192 | vertices = vertices / (resolution - 1.0) * (b_max_np - b_min_np)[None, :] + b_min_np[None, :] |
| 193 | |
| 194 | return vertices, triangles |
| 195 | |
| 196 | class Trainer(object): |
| 197 | def __init__(self, |
nothing calls this directly
no test coverage detected