1

I am using OpenVR (a python binding) to extract the angles from the rotation matrix.

I have an algorithm which gives me those angles. By the way, I need to integrate those angles into another system, which uses a different sequence of rotations.

OpenVR gives me a ZYX Rotation Matrix, I need a YXZ one. Does some algorhitm exist to do the conversion?

  • 1
    If you need a matrix, then just use the matrix that OpenVR gives you. The matrix does not depend on any order of rotation. That is only a problem of Euler angles. – Nico Schertler Oct 26 '18 at 13:24
  • 1
    actually I need to create a file for another program, Lightwave, which has a different rotation order. OpenVR uses ZYX, while Lightwave uses YXZ convention. So I guess that I should first convert a matrix to the other, and only then I can get the euler angles for every frame. Correct? – Paolo Gambardella Oct 26 '18 at 14:43
  • 1
    What do you need? A matrix or Euler angles? – Nico Schertler Oct 26 '18 at 15:25
  • @PaoloGambardella that sounds about OK ... the transform between matrices is just multiplying basis vectors and position by direct or inverse matrix of the other coordinate system. vectors use `w=0` and position `w=1`. See [Understanding 4x4 homogenous transform matrices](https://stackoverflow.com/a/28084380/2521214). Sometimes is enough to multiply the matrices together but order of multiplication and which one is inversed or not depends on the notations and coordinate systems properties you are using ... – Spektre Oct 27 '18 at 07:50
  • @NicoSchertler I need to put the right roation into the lightwave structure, which is something like: `AddCamera 30000000 CameraName Camera ShowCamera 1 14 CameraMotion NumChannels 6 Channel 0 { Envelope 2 Key 0 0 0 0 0 0 0 0 0 Key 0 4 0 0 0 0 0 0 0 Behaviors 1 1 } Channel 1 { Envelope 2 Key 0 0 0 0 0 0 0 0 0 Key 0 4 0 0 0 0 0 0 0 Behaviors 1 1 } Channel 2 { Envelope 2 Key -5 0 0 0 0 0 0 0 0 Key -5 4 0 0 0 0 0 0 0 Behaviors 1 1 } – Paolo Gambardella Oct 29 '18 at 09:07
  • 1
    I have no clue what this snippet means or where there could be a rotation in there. Please make it easier for people to help you by specifying exactly what you need. – Nico Schertler Oct 29 '18 at 09:54
  • it is the lightwave file, and every channel has the rotation value, in the order yaw, pitch and roll. In radians. Right now I am using the SteamVR plugin in Unity, but the rotation axis of the Vive Tracker are swapped. For instance, when I put the device and I manually make a yaw, it rotates in the z axis and not in the y one. – Paolo Gambardella Oct 29 '18 at 10:55

0 Answers0