Euler Angles

How can I get Euler angles from a transformation matrix?

Hi @AmicoCAD,

Use either Transform.GetYawPitchRoll or Transform.GetEulerZYZ.

– Dale


How to?

.GetYawPitchRoll returns a boolean, you need to use “out” to get your values.

  private void RunScript(Transform Matrice, ref object Yaw, ref object Pitch, ref object Roll)
    double yaw, pitch, roll;
    bool success = Matrice.GetYawPitchRoll(out yaw, out pitch, out roll);
    Yaw = yaw;
    Pitch = pitch;
    Roll = roll;
1 Like

Why this error?

2021-08-22 12_33_08-Window
2021-08-22 12_33_20-Window
2021-08-22 12_33_38-Window


Lo stesso degli altri che non ho specificato.

@dale, Why are the extracted angles not the starting ones?

If you want an answer it is surely best to post the script.

Because at first glance I shall say you have done an error. Euler angles are tricky.

Not at all (anyway there’s tons of related literature around).

BTW: One should fully understand the 3D M[4,4] Trans Matrix (general case).

Hello Peter
I am doing 6 dof simulations. Yes angles are tricky because if you use matrix quaternions … order of rotations are not always the same. Sometime
Yaw * Pitch * Roll
And sometime
Roll * Pitch * Yaw.
So an error in the order brings error at the end …

1 Like

Well … the core of the matter is to define what exactly are YPR in the classic 3D 4*4 TMatrix (see capture above as well for the orthodox (or not) way to cut the mustard).

Anyway, get this as well

JN_TransMatricesMaths.pdf (3.0 MB)

May The Force (the Dark option) be with you.

Screen Shot 045


But there is no solution or answer that does not require study ceiling?

The methods indicated by @dale… how can it help me?
At the moment I can not deepen the theory. Is there a quick fix?

Post your script
Post your script
Post your script

it is quite impossible to help you just with a screen copy.

Hi @AmicoCAD,

Let me know if this is helpful or not… (9.9 KB)

– Dale

1 Like

Thanks @dale, unfortunately, however, the code is not able to get the initial angles.
If I can get the Euler angles, applying opposite angles I return to the initial configuration. (128.5 KB)

Did you notice that the values are mirrored in the inner 3x3 matrix. I bet it’s because of reversing in wrong order or assigning the values to wrong indices. Still, as Laurent says, Euler angles are tricky. I found this website very useful when I had to implement my own math library for it. Maths - Conversion Euler To Matrix - Martin Baker

And so Transform.GetYawPitchRoll doesn’t work?

See this as well:

I looked a bit at your script. You use Pufferfish. So there is surely a difference between angle from Pufferfish and rhinocommon. In aeronautics for rocket x is oriented tothe front z at the bottom
ROLL is on X. …