本文整理汇总了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