Euler Angles calculation using flattened orientation matrix

Hi ,

I am trying to calculate Euler angles (yaw,pitch and roll) in degree for my demo. The device i am using is Astra S . I have asked the same issue few days back but the reply i received didn’t solved my problem.

I have following queries:-

1).Flattened array contain elements in following order
nuitrack::orientation::matrix[9] = 1 2 3 4 5 6 7 8 9
how to fill 3x3 matrix using above flattened matrix
option 1:
|1|2|3|
|4|5|6|
|7|8|9|

or
Option 2:
|1|4|7|
|2|5|8|
|3|6|9|

2). I have been told to use following link
Eigen: https://eigen.tuxfamily.org/dox/group__Geometry__Module.html#title40

Please note that instead of the following code:

Vector3f ea = mat.eulerAngles(2, 0, 2);

you have to use:

Vector3f ea = mat.eulerAngles(2, 1, 0);

So my question is the how euler angles are stored in variable ea , i mean
yaw =ea[0] , pitch = ea[1] and roll = ea[2] or some thing else.

  1. In one of your article “https://nuitrack.com/tutorial01” I found that

"Nuitrack does not track the rotation of the head due to technical limitations, so you need to use the GoogleVR plugin for simple helmets or OcculusVR for the GearVR platform. "

So can i expect correct yaw, pitch, roll values from your libraries or not ?

Please help.

Hi Asit,

  1. Both options are possible.
    For Option 1, you have to use the following rule of matrix multiplying: R*v, where v is a 3x1 vector-column.
    For Option 2, the rule is v*R, where v is a 1x3 vector-row.

  2. In accordance with the Eigen documentation, yaw =ea[0] , pitch = ea[1] and roll = ea[2]

  3. Orientation will be correct for non-terminal joints in skeletal topology. Orientation of a terminal joint will be the same as orientation of its parent joint.