MCPcopy Create free account
hub / github.com/Atrovast/THGS / viewmatrix

Function viewmatrix

utils/render_utils.py:59–66  ·  view source on GitHub ↗

Construct lookat view matrix.

(lookdir: np.ndarray, up: np.ndarray,
               position: np.ndarray)

Source from the content-addressed store, hash-verified

57 return cam2world
58
59def viewmatrix(lookdir: np.ndarray, up: np.ndarray,
60 position: np.ndarray) -> np.ndarray:
61 """Construct lookat view matrix."""
62 vec2 = normalize(lookdir)
63 vec0 = normalize(np.cross(up, vec2))
64 vec1 = normalize(np.cross(vec2, vec0))
65 m = np.stack([vec0, vec1, vec2, position], axis=1)
66 return m
67
68def focus_point_fn(poses: np.ndarray) -> np.ndarray:
69 """Calculate nearest point to all focal axes in poses."""

Callers 2

average_poseFunction · 0.85
generate_ellipse_pathFunction · 0.85

Calls 1

normalizeFunction · 0.85

Tested by

no test coverage detected