MCPcopy
hub / github.com/TencentARC/Pixal3D / sphere_normalize_torch

Function sphere_normalize_torch

data_toolkit/utils.py:542–552  ·  view source on GitHub ↗

Sphere normalization: normalize vertices based on sphere radius.

(vertices)

Source from the content-addressed store, hash-verified

540
541
542def 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
555def save_image_with_notes(img, path, notes=None):

Callers 2

transform_pbr_dumpFunction · 0.90
_dual_grid_mesh_viewFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected