Hi, I'm new to openvr. Could anyone explain why the pitch angle is calculated by atan2(pose_mat[2][0], pose_mat[0][0]) in convert_to_euler function, instead of atan2(-pose_mat[2][0], math.sqrt(pow(pose_mat[2][1], 2) + math.pow(pose_mat[2][2], 2))? which is the usual way to transfer euler from matrix and could also transfer euler to matrix by R(roll)R(pitch)R(yaw).
And If I use this euler data, how could I transfer euler to rotation matrix? Thanks !
def convert_to_euler(pose_mat):
yaw = 180 / math.pi * math.atan2(pose_mat[1][0], pose_mat[0][0])
pitch = 180 / math.pi * math.atan2(pose_mat[2][0], pose_mat[0][0])
roll = 180 / math.pi * math.atan2(pose_mat[2][1], pose_mat[2][2])
x = pose_mat[0][3]
y = pose_mat[1][3]
z = pose_mat[2][3]
return [x,y,z,yaw,pitch,roll]
Hi, I'm new to openvr. Could anyone explain why the pitch angle is calculated by atan2(pose_mat[2][0], pose_mat[0][0]) in convert_to_euler function, instead of atan2(-pose_mat[2][0], math.sqrt(pow(pose_mat[2][1], 2) + math.pow(pose_mat[2][2], 2))? which is the usual way to transfer euler from matrix and could also transfer euler to matrix by R(roll)R(pitch)R(yaw).
And If I use this euler data, how could I transfer euler to rotation matrix? Thanks !
def convert_to_euler(pose_mat):
yaw = 180 / math.pi * math.atan2(pose_mat[1][0], pose_mat[0][0])
pitch = 180 / math.pi * math.atan2(pose_mat[2][0], pose_mat[0][0])
roll = 180 / math.pi * math.atan2(pose_mat[2][1], pose_mat[2][2])
x = pose_mat[0][3]
y = pose_mat[1][3]
z = pose_mat[2][3]
return [x,y,z,yaw,pitch,roll]