in eval/cameras/rotate.py [0:0]
def __getitem__(self, idx):
t = (np.cos(idx * 2. * np.pi / self.period) * 0.5 + 0.5)
x = np.cos(t * 0.5 * np.pi + 0.25 * np.pi) * 3.
y = 0.5
z = np.sin(t * 0.5 * np.pi + 0.25 * np.pi) * 3.
campos = np.array([x, y, z], dtype=np.float32)
lookat = np.array([0., 0., 0.], dtype=np.float32)
up = np.array([0., -1., 0.], dtype=np.float32)
forward = lookat - campos
forward /= np.linalg.norm(forward)
right = np.cross(up, forward)
right /= np.linalg.norm(right)
up = np.cross(forward, right)
up /= np.linalg.norm(up)
camrot = np.array([right, up, forward], dtype=np.float32)
px, py = np.meshgrid(np.arange(self.width).astype(np.float32), np.arange(self.height).astype(np.float32))
pixelcoords = np.stack((px, py), axis=-1)
return {"campos": campos,
"camrot": camrot,
"focal": self.focal,
"princpt": self.princpt,
"pixelcoords": pixelcoords}