opengl - How to flip only one axis of transformation matrix? -
i have 4x4 transformation matrix. however, after trying out transformation noticed movement and rotation of y axis going opposite way. rest correct.
i got matrix other api difference of coordinate system. so, how can flip axis of transformation matrix?
if translation can add minus sign on y translation, have no idea opposite rotation of 1 axis since rotation being represented in same 3x3 area. thought there might way affect both translation , rotation @ same time. (truly flipping axis)
edit: i'm pretty sure operation you're looking changing coordinate systems while maintaining z-up or y-up. in case, try setting elements of second column (or row) of matrix inverse.
this question better math stackexchange. first, a helpful read on rotation matrices.
the first problem matter of rotation order. assuming xyz rotation order. know rotation matrices each axis follows:
given matrix derived same rotation order, resulting matrix follows, alpha x angle, beta y angle, , gamma z angle:
you can derive individual components of each axis angle matrix. example, can derive y angle -sin(beta) using inverse trig. given beta, can derive alpha cos(beta)sin(alpha). can derive gamma cos(beta)sin(gamma). note same number in matrix can represent multiple values (e.g. sin(0)=0 , sin(180)=0).
now know alpha, beta, , gamma, can reverse beta , remake rotation matrix.
there's chance there's better way using quaternions, should ask math stackexchange these kinds of language-agnostic questions.


Comments
Post a Comment