# Implementation or Documentation of Root::Math::RotationZYX wrong

XMLWordPrintable

#### Details

• Bug
• Status: Closed
• High
• Resolution: Fixed
• None
• None
• None
• CERN CentOS7, ROOT 6.10

#### Description

As posted in the ROOT forums here: https://root-forum.cern.ch/t/documentation-of-math-rotationzyx/26814

I am having issues understanding the documentation provided for the `ROOT::Math::RotationZYX` class. On the doxygen (here: https://root.cern.ch/doc/v610/classROOT_1_1Math_1_1RotationZYX.html ) it says:

> Rotation class with the (3D) rotation represented by angles describing first a rotation of an angle phi (yaw) about the Z axis, followed by a rotation of an angle theta (pitch) about the new Y' axis, followed by a third rotation of an angle psi (roll) about the final X'' axis.

I understand this as the description of an _intrinsic 321 Euler rotation_ since the second and third rotations are performed around the new axes. However, a simple example seems to prove me wrong:

Consider the following expression:
```
ROOT::Math::XYZVector result = ROOT::Math::RotationZYX(0.5*Pi(), 0, 0.5*Pi())*ROOT::Math::XYZVector(0, 0, 1)
```
Now, consider the following two interpretations:

1. Intrinsic:

Following the description on the documentation page (ie. interpreting this as intrinsic rotations) I would expect the following result - starting from a right-handed Cartesian coordinate system:

• Start with right-handed coordinate system: `x` left, `y` up, `z` away from you
• Rotate around `z`, so now `x'` up, `y'` right, `z'` away
• Do not rotate around `y'`
• Rotate around `x''`, so now `x'''` up, `y'''` away from you, `z'''` to the left
• For _intrinsic_ rotations, I would expect the result of the rotation to be (1,0,0)
1. Extrinsic:

However, this does not match with the result I receive from ROOT when executing the above example. Instead, what I get is along the following lines - interpreting the rotations as extrinsic:

• Start with right-handed coordinate system: `x` left, `y` up, `z` away from you
• Rotate around `z`, so now `x'` up, `y'` right, `z'` away
• Do not rotate around `y`
• Rotate around `x` (which is equivalent to `-y'`), so now `x'''` away from you, `y'''` to the right, `z'''` down
• For _extrinsic_ rotations, I would expect (0,-1,0) - and this is what I receive from ROOT.

To summarize, the documentation of `RotationZYX` seems to suggest an intrinsic rotation, but what ROOT actually performs is an extrinsic rotation.

Could you please point me to my mistake?

#### People

Lorenzo Moneta
Simon Spannagel