MCPcopy Create free account
hub / github.com/openai/shap-e / camera_rays

Method camera_rays

shap_e/rendering/view_data.py:91–96  ·  view source on GitHub ↗
(self, coords: np.ndarray)

Source from the content-addressed store, hash-verified

89 return coords
90
91 def camera_rays(self, coords: np.ndarray) -> np.ndarray:
92 fracs = (coords / (np.array([self.width, self.height], dtype=np.float32) - 1)) * 2 - 1
93 fracs = fracs * np.tan(np.array([self.x_fov, self.y_fov]) / 2)
94 directions = self.z + self.x * fracs[:, :1] + self.y * fracs[:, 1:]
95 directions = directions / np.linalg.norm(directions, axis=-1, keepdims=True)
96 return np.stack([np.broadcast_to(self.origin, directions.shape), directions], axis=1)
97
98 def depth_directions(self, coords: np.ndarray) -> np.ndarray:
99 return np.tile((self.z / np.linalg.norm(self.z))[None], [len(coords), 1])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected