Can i switch X Y Z in a quaternion?

前端 未结 4 1719
忘掉有多难
忘掉有多难 2021-02-08 14:28

i have a coordinate system where the Y axis is UP. I need to convert it to a coordinate system where Z is UP. I have the rotations stored in quaternions, so my question is : if

4条回答
  •  再見小時候
    2021-02-08 14:51

    No, you cannot exchange y and z -- it will turn into a Left-Handed Coordinate system, if it was Right-Handed (and vice-versa).

    You can, however, do the following substitution:

    newX = oldZ
    newY = oldX
    newZ = oldY
    

    I suspect that what you really want is a simple rotation about the x axis. If that's why you want to switch y and z, then you should instead apply a rotation of -90 degrees about the +x axis (assuming you have a Right-Handed coordinate system).

提交回复
热议问题