INNER CODE UNIT · Python
update_pose
muskie82/MonoGS · gui/gui_utils.py:23
def update_pose(self, pose):
points = np.asarray(self.line_set.points)
points_hmg = np.hstack([points, np.ones((points.shape[0], 1))])
points = (pose @ points_hmg.transpose())[0:3, :].transpose()
base = np.array([[0.0, 0.0, 0.0]]) * self.size
base_hmg = np.hstack([base, np.ones((base.shape[0], 1))])
cameraeye = pose @ base_hmg.transpose()
cameraeye = cameraeye[0:3, :].transpose()
eye = cameraeye[0, :]
base_behind = np.array([[0.0, -2.5, -30.0]]) * self.size
base_behind_hmg = np.hstack([base_behind, np.ones((base_behind.shape[0], 1))])
cameraeye_behind = pose @ base_behind_hmg.transpose()
cameraeye_behind = cameraeye_behind[0:3, :].transpose()
eye_behind = cameraeye_behind[0, :]
center = np.mean(points[1:, :], axis=0)