Sphere normalization: normalize vertices based on sphere radius.
(vertices)
| 540 | |
| 541 | |
| 542 | def sphere_normalize_torch(vertices): |
| 543 | """ |
| 544 | Sphere normalization: normalize vertices based on sphere radius. |
| 545 | """ |
| 546 | bmin = torch.min(vertices, dim=0)[0] |
| 547 | bmax = torch.max(vertices, dim=0)[0] |
| 548 | bcenter = (bmax + bmin) / 2 |
| 549 | assert bcenter.abs().max() < 0.25, f"bcenter is not close to origin: {bcenter}" |
| 550 | radius = torch.norm(vertices - bcenter, dim=-1).max() |
| 551 | vertices_normalized = vertices / radius |
| 552 | return vertices_normalized, bcenter, radius |
| 553 | |
| 554 | |
| 555 | def save_image_with_notes(img, path, notes=None): |
no outgoing calls
no test coverage detected