You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to understand how rotation works in Tungsten. I notice that there are 2 rotation functions in Mat4f, namely rotXYZ() and rotYXZ(). I did not find documentation for the formula so I tried to compose 3 rotation matrices (w.r.t. x, y, and z axes) to reconstruct these 2 functions. However, I found some inconsistency between these 2 functions.
For a certain rotation vector [x_angle, y_angle, z_angle], Assume the rotation matrices are named rot_x(x_angle), rot_y(y_angle) and rot_z(z_angle). Also assume that rot_*.dot(v) is the correct way to rotate a vector v (same convention as in Tungsten). The rotXYZ() function can be reconstructed as rot_z.dot(rot_y).dot(rot_x). However, the rotYXZ() function cannot be reconstructed as rot_z.dot(rot_x).dot(rot_y), as expected, but can be reconstructed by rot_y.transpose().dot(rot_x).dot(rot_z).
Could anyone explain the reason of having 2 different rotation functions that are formulated inconsistently?
Thanks in advance.
The text was updated successfully, but these errors were encountered:
I know it actually does rot_y(-y_angle) * rot_x(x_angle) * rot_z(z_angle), and it is the method called when reading the scene config files (see src/core/io/JsonPtr.cpp). Probably @tunabrain could give a reason of this design?
Hi,
I am trying to understand how rotation works in Tungsten. I notice that there are 2 rotation functions in
Mat4f
, namelyrotXYZ()
androtYXZ()
. I did not find documentation for the formula so I tried to compose 3 rotation matrices (w.r.t. x, y, and z axes) to reconstruct these 2 functions. However, I found some inconsistency between these 2 functions.For a certain rotation vector
[x_angle, y_angle, z_angle]
, Assume the rotation matrices are namedrot_x(x_angle)
,rot_y(y_angle)
androt_z(z_angle)
. Also assume thatrot_*.dot(v)
is the correct way to rotate a vectorv
(same convention as in Tungsten). TherotXYZ()
function can be reconstructed asrot_z.dot(rot_y).dot(rot_x)
. However, therotYXZ()
function cannot be reconstructed asrot_z.dot(rot_x).dot(rot_y)
, as expected, but can be reconstructed byrot_y.transpose().dot(rot_x).dot(rot_z)
.Could anyone explain the reason of having 2 different rotation functions that are formulated inconsistently?
Thanks in advance.
The text was updated successfully, but these errors were encountered: