Euler Angles

How can I get Euler angles from a transformation matrix?

Use either Transform.GetYawPitchRoll or Transform.GetEulerZYZ.

â€“ Dale

2 Likes

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?

â€¦typo?

Lo stesso degli altri che non ho specificato.
Var?

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

Hello
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.

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?

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

Let me know if this is helpful or notâ€¦

test_yaw_pitch_roll.gh (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.

Eulero_Forum.gh (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:

https://brainvoyager.com/bv/doc/UsersGuide/CoordsAndTransforms/SpatialTransformationMatrices.html

Hello
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. â€¦