MCPcopy Create free account
hub / github.com/DSL-Lab/StreamSplat / getOrthProjectionMatrix

Function getOrthProjectionMatrix

gaussian_renderer_dynamic/__init__.py:36–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34world_view_transform = torch.tensor(getWorld2View2(R_fixed, T_fixed, np.array([0.0, 0.0, 0.0]), 1.0)).transpose(0, 1)
35
36def getOrthProjectionMatrix():
37 znear, zfar = 0., 10.0
38 top = 1
39 bottom = -top
40 right = 1
41 left = -right
42 # Create an identity matrix
43 P = torch.zeros(4, 4)
44 z_sign = 1.0 # Adjust this based on handedness (e.g., 1.0 for right-handed, -1.0 for left-handed)
45 P[0, 0] = 2.0 / (right - left)
46 P[1, 1] = 2.0 / (top - bottom)
47 P[2, 2] = -2.0 * z_sign / (zfar - znear)
48 P[0, 3] = -(right + left) / (right - left)
49 P[1, 3] = -(top + bottom) / (top - bottom)
50 P[2, 3] = -(zfar + znear) / (zfar - znear)
51 P[3, 3] = 1.0
52
53 return P
54
55projection_matrix = getOrthProjectionMatrix().transpose(0,1)
56

Callers 1

__init__.pyFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected