MCPcopy Create free account
hub / github.com/NVlabs/InstantSplat / build_rotation

Function build_rotation

utils/general_utils.py:78–99  ·  view source on GitHub ↗
(r)

Source from the content-addressed store, hash-verified

76 return strip_lowerdiag(sym)
77
78def build_rotation(r):
79 norm = torch.sqrt(r[:,0]*r[:,0] + r[:,1]*r[:,1] + r[:,2]*r[:,2] + r[:,3]*r[:,3])
80
81 q = r / norm[:, None]
82
83 R = torch.zeros((q.size(0), 3, 3), device='cuda')
84
85 r = q[:, 0]
86 x = q[:, 1]
87 y = q[:, 2]
88 z = q[:, 3]
89
90 R[:, 0, 0] = 1 - 2 * (y*y + z*z)
91 R[:, 0, 1] = 2 * (x*y - r*z)
92 R[:, 0, 2] = 2 * (x*z + r*y)
93 R[:, 1, 0] = 2 * (x*y + r*z)
94 R[:, 1, 1] = 1 - 2 * (x*x + z*z)
95 R[:, 1, 2] = 2 * (y*z - r*x)
96 R[:, 2, 0] = 2 * (x*z - r*y)
97 R[:, 2, 1] = 2 * (y*z + r*x)
98 R[:, 2, 2] = 1 - 2 * (x*x + y*y)
99 return R
100
101def build_scaling_rotation(s, r):
102 L = torch.zeros((s.shape[0], 3, 3), dtype=torch.float, device="cuda")

Callers 2

densify_and_splitMethod · 0.90
build_scaling_rotationFunction · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected