9
$\begingroup$

My understanding

There are several possibilities for representing a rotation, e.g. direction + angle, which is the most visual but requires two distinct objects, and matrix or quaternion, which are preferred for computation but not visual at all.

Blender uses the previous methods and also an Euler angle representation, similar to a gimbal system. Any transform in a 3D space, excluding pure translations, can be expressed by three angles representing a chain of three rotations around three different axes in a specific order.

There is an infinity of choices for the axes. Usually axes are part of a Cartesian frame XYZ, and either fixed (extrinsic) or rotated (intrinsic). Proper Euler angles use a chain with the same axis for the first and third rotation, Tait-Bryan angles use different axes for the three rotations, but are also often referred to as Euler angles. One commonly used possibility is:

Diagram showing stages of a rotation

The red axes initially aligned with XYZ have been rotated by φ about Z, then by Φ about ξ, the older X axis now rotated, and finally by Ψ about ζ, the old Z. This Euler mode would be referred to as ZX'Z'' to give a meaning to the triplet (φ, Φ, Ψ).

In Blender these three angles can be grouped into a Vector of floats when a single object is preferred to represent the rotation. Still the angles mean nothing unless we know the chain of axes used (mode).

What the documentation says

From the Advanced section:

The special thing about this is that the axes have a hierarchical relationship between them: one of the axes is at the top of the hierarchy, and has one of the other two axes as its immediate child; at the same time, this child axis is the parent of the remaining axis, the one at the very bottom of the hierarchy.

Which axis is on top, which one in the middle and which at the bottom, depends on the particular Euler gimbal: there are six types of them, as there are six possible combinations: XYZ, XZY, YXZ, YZX, ZXY and ZYX Euler rotation modes. These modes are named using the letters of the axes in order, starting from the axis at the bottom of the hierarchy, and finishing with the one on top.

It doesn't indicate which mode is used.

My experiment

I setup an experiment to try understand which mode Blender uses:

enter image description here

It's just three Cartesian systems, a fixed set of XYZ axes, one set with darker colors randomly oriented using a Transform node and used as a target. One last in lighter colors can be oriented manually using a Rotate Euler (Euler + Object options) connected to a Transform.

I'm able to match the darker system by orienting the mobile system. When matching, the Euler angle values match. But I still have trouble understanding the axes used.

When manipulating the Y input of Rotate Euler, and looking along the world Y axis:

enter image description here

It can be seen that the size of the rotated light green axis changes during the rotation, which indicates the rotation is not about the world Y axis. I tried other possibilities but I was not able to determine which axis is associated with the Y input.

Question

What are the axes and the axis order used in Euler defined rotation?


$\endgroup$
5
  • $\begingroup$ Note: I had to select an answer, but actually the three existing answers are interesting to read and provide their own elements. Thanks to the three authors. $\endgroup$
    – mins
    Aug 16, 2022 at 9:19
  • 1
    $\begingroup$ Fun semirelated math fact: If you use the three Euler angles in some order, applied to global coordinate axes, then you get exactly the same result as if you apply the same angles in the opposite order, but to local axes. $\endgroup$
    – Arthur
    Aug 16, 2022 at 11:09
  • $\begingroup$ ("Local axes" as in they start out the same as the global axes, but follow the rotating object as it rotates.) $\endgroup$
    – Arthur
    Aug 16, 2022 at 11:15
  • 1
    $\begingroup$ @Arthur: See Davenport angles. $\endgroup$
    – mins
    Aug 16, 2022 at 12:53
  • $\begingroup$ Oh, there is even a name for it. Cool, didn't know that. $\endgroup$
    – Arthur
    Aug 16, 2022 at 12:57

4 Answers 4

12
$\begingroup$

In the viewport, you can select the order of Euler component rotations:

enter image description here

But in GN, you are not offered the choice. It's XYZ.

Unless you're offered a 'Local' option for entities with their own axes, such as instances (or rotations, which you can think of as axes themselves), transforms in GN are of the geometry, in its object's space, as previously transformed at object-level. (Just like other modifiers.) So rotations are about the modified object's axes.

Euler rotations are compounded; as in a physical gimbal, each axis becomes the child of the axis before it. Chaining single-axis Eulers in another order does not work. The axes revert to the object's, after a rotation is executed.

If you want to assemble your own compound Euler rotation in GN, setting the axis order, you can do this...

enter image description here

... for example, to get a ZXY compound Euler rotation of 30 in Z, followed by 10 in X, followed by 20 in Y.

Note the rotations are 'Local', and read backwards from their effect.

$\endgroup$
5
  • $\begingroup$ My edited answer has some of the information in your answer. However, you seem to actually know this, while I've only drawn empirical conclusions from experimenting while I was writing. I bow to thee. +1 $\endgroup$ Aug 15, 2022 at 19:51
  • $\begingroup$ "rotations are about the modified object's axes", if I understand correctly, the elementary rotations are processed this way: Rotation about local X by the value of the first angle, then about rotated local Y by the second angle, and about twice rotated local Z by the last angle? $\endgroup$
    – mins
    Aug 15, 2022 at 19:54
  • 2
    $\begingroup$ @InTheAbsenceOfFear .. sorry, didn't mean to tread on your perfectly good answer, I was phrasing mine and checking everything, to make sure it was right, as far as it goes, while you were writing yours. No bow required, +1 too. $\endgroup$
    – Robin Betts
    Aug 15, 2022 at 19:55
  • 1
    $\begingroup$ You posted your answer while I was editing mine. Consequently, I didn't know of yours until I was done, and you didn't know of my edit. I do in no way feel trodden on. And don't put to much into my "I bow to thee". I just like such phrases. :) $\endgroup$ Aug 15, 2022 at 20:02
  • 2
    $\begingroup$ @mins Right! I just deleted a comment repeating exactly what you said. The axes start out aligned to the object's. then each axis is rotated by the previous component of the Euler, in order. Like a mechanical gimbal. $\endgroup$
    – Robin Betts
    Aug 15, 2022 at 20:06
6
$\begingroup$

As far as I can tell from the source code, Rotate Euler is simply multiplying two matrices after translating the Euler rotations into them.

The translation from Euler rotation to matrix is as follows:

/******************************** XYZ Eulers *********************************/

void eul_to_mat3(float mat[3][3], const float eul[3])
{
  double ci, cj, ch, si, sj, sh, cc, cs, sc, ss;

  ci = cos(eul[0]);
  cj = cos(eul[1]);
  ch = cos(eul[2]);
  si = sin(eul[0]);
  sj = sin(eul[1]);
  sh = sin(eul[2]);
  cc = ci * ch;
  cs = ci * sh;
  sc = si * ch;
  ss = si * sh;

  mat[0][0] = (float)(cj * ch);
  mat[1][0] = (float)(sj * sc - cs);
  mat[2][0] = (float)(sj * cc + ss);
  mat[0][1] = (float)(cj * sh);
  mat[1][1] = (float)(sj * ss + cc);
  mat[2][1] = (float)(sj * cs - sc);
  mat[0][2] = (float)-sj;
  mat[1][2] = (float)(cj * si);
  mat[2][2] = (float)(cj * ci);
}

Source

So it looks like an XYZ translation.

$\endgroup$
1
  • 1
    $\begingroup$ for a little more context - this is the "pitch roll yaw" convention - see mathworld.wolfram.com/EulerAngles.html equations 51-59, with i=roll, j=pitch, h=yaw $\endgroup$
    – zephyr
    Mar 24, 2023 at 13:48
5
$\begingroup$

The axis order for Euler rotations can be set. Click the drop down list Mode in the Transform tab in Object Properties.

enter image description here

I did some testing on this, by setting the Euler rotation from python on one cube and then on another cube I rotated manually (using R followed by angle) on the global axes in the same order as I did in python, and the two cubes lined up. My conclusion is that the axis order refers to the global axes, i.e. Tait-Bryan rotation.

The comments I received made me want to understand this. I'm not sure the following will fully answer the OP's question, but I'm hoping it'll at least be a step in the right direction. A little more testing (after a more thorough reading of the question) gave this result. I did enable displaying the object local axes to make things clearer.

enter image description here

enter image description here

Look at the rotation set in the Object Properties panel, and at the local axis indicators. It seems that the local axes inferred by the rotation in the Object Properties are taken by Geometry Nodes as the axes around which to calculate rotations and along which to do scaling and translation. Look at the rotational difference between the two images, and you'll note that the cylinder is rotated about the object's local axis, which is indicated by an X (there are also lines going to the object origin, but those are obscured by the object's geometry).

$\endgroup$
5
  • $\begingroup$ Thanks, it's an interesting addition. +1, but I've two comments. This is valid for the N-Panel UI, I don't see an equivalence to select the Euler mode in Transform GN (so one mode must be used by default). Also ref. you conclusion: I tested changing Y value in my setup and looking from the global Y axis, the rotation was not preserving the distances to the center, hence it was not about the world Y. I may be wrong, just a comment. $\endgroup$
    – mins
    Aug 15, 2022 at 18:29
  • $\begingroup$ @mins I guess I didn't read thoroughly enough. I missed that you were doing this in GN. I just did a very quick test, and it looks like Tait-Bryan XYZ to me. If it doesn't preserve the distances to the centre, are you sure the object origin is at the centre of the object? Rotations are done about the object origin, which may very well be offset from the centre. $\endgroup$ Aug 15, 2022 at 18:45
  • $\begingroup$ @mins Like I said, I guess I didn't read thoroughly enough. Apologies for that. Unfortunately I've not bothered to learn GN yet, and I can't really provide any more insight. Just a thought though. I noticed that if geometry is added from within GN, it does seem to behave differently, as if its centre and/or origin is offset. This may well also affect rotations. $\endgroup$ Aug 15, 2022 at 19:06
  • 1
    $\begingroup$ @mins Did some further testing, and edited my answer to include a bit more info. $\endgroup$ Aug 15, 2022 at 19:40
  • 1
    $\begingroup$ I appreciate your additional info and effort. $\endgroup$
    – mins
    Aug 15, 2022 at 19:59
0
$\begingroup$

Blender uses extrinsic rotations. We can verify this by using the standard XYZ Euler mode on an asymmetric object and then sliding the X and Y rotations to some value like 67 and 23 degrees. If we then slide the Z rotation up, we will see that the rotation is performed about the original, fixed Z-axis, and not the new Z-axis formed by the original X/Y rotations.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .