def lookAtTransform(pos, target, up, square=False, camera=False):
pos = np.array(pos, np.float32)
target = np.array(target, np.float32)
up = np.array(up, np.float32)
# print 'lookAtTransform:'
dir = target - pos
R = rotationFromVectors(dir, up, camera=camera)
# print 'R:', R
pos = np.matrix(pos).T
V = np.column_stack((R, -R*pos))
if square:
V = np.row_stack((
V,
np.array([0,0,0,1], np.float32)
))
return V
评论列表
文章目录