本文整理匯總了Python中src.rotation_utils.rotate_camera_to_point_at方法的典型用法代碼示例。如果您正苦於以下問題:Python rotation_utils.rotate_camera_to_point_at方法的具體用法?Python rotation_utils.rotate_camera_to_point_at怎麽用?Python rotation_utils.rotate_camera_to_point_at使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類src.rotation_utils
的用法示例。
在下文中一共展示了rotation_utils.rotate_camera_to_point_at方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: position_camera
# 需要導入模塊: from src import rotation_utils [as 別名]
# 或者: from src.rotation_utils import rotate_camera_to_point_at [as 別名]
def position_camera(self, camera_xyz, lookat_xyz, up):
camera_xyz = np.array(camera_xyz)
lookat_xyz = np.array(lookat_xyz)
up = np.array(up)
lookat_to = lookat_xyz - camera_xyz
lookat_from = np.array([0, 1., 0.])
up_from = np.array([0, 0., 1.])
up_to = up * 1.
# np.set_printoptions(precision=2, suppress=True)
# print up_from, lookat_from, up_to, lookat_to
r = ru.rotate_camera_to_point_at(up_from, lookat_from, up_to, lookat_to)
R = np.eye(4, dtype=np.float32)
R[:3,:3] = r
t = np.eye(4, dtype=np.float32)
t[:3,3] = -camera_xyz
view_matrix = np.dot(R.T, t)
flip_yz = np.eye(4, dtype=np.float32)
flip_yz[1,1] = 0; flip_yz[2,2] = 0; flip_yz[1,2] = 1; flip_yz[2,1] = -1;
view_matrix = np.dot(flip_yz, view_matrix)
view_matrix = view_matrix.T
# print np.concatenate((R, t, view_matrix), axis=1)
view_matrix = np.reshape(view_matrix, (-1))
view_matrix_o = glGetUniformLocation(self.egl_program, 'uViewMatrix')
glUniformMatrix4fv(view_matrix_o, 1, GL_FALSE, view_matrix)
return None, None #camera_xyz, q