Figuring out matrix convention

I'm trying to decode an old 3D file format, and I have found the following matrix:

$$\begin{bmatrix}-1 & -0 & -0\\0 & 1 & 0\\0 & 0 & 1\end{bmatrix}$$

This matrix represents a rotation, and from that I can understand, the end result should be a $180\unicode{xB0}$ rotation over $Y$.

However, if this were a normal $XYZ$ matrix, elements $R_{11}$ and $R_{33}$ should actually be the same, which tells me this might be something else.

So my question is, does anybody know what kind of "convention" (sorry if this is not the right term) this matrix represents, and how I can convert this matrix to actual Euler angles and/or quaternions for me to use? Or at least how can I figure out what convention this uses in some generic way?

I've also tried converting the same matrix to different conventions, but I've only found how to do this for XYZ, ZYZ and ZYX, and none of those seem to match.


Solution 1:

As @am301 notes, this matrix reflects $x$ while preserving $y,\,z$. It is a reflection. It's an orthogonal matrix, but since its determinant is $-1$ it's an "improper rotation". You can think of it as a rotation through a fourth dimension.

Solution 2:

Three-dimensional Euclidean space has two different basis orientations. If you use your thumb for $x$ axis, your forefinger for $y$ axis, and your middle finger for $z$ axis, and keep them perpendicular to each other, then your right hand corresponds to right-handed coordinate system, and your left hand corresponds to left-handed coordinate system.

To switch between the two, you mirror the coordinate system; usually by negating one of the coordinates. (If you compare your left and right hands, and rotate them in different positions, you can see that if you could just flip any one of the three fingers in either hand into the opposite direction (ouch!), both hands would have the three fingers pointing in the same directions.)

This kind of "mirroring", be it along an axis or along an arbitrary vector, is an improper rotation. You can do it using an orthonormal matrix – for example the one shown by OP –, but it will have a determinant of $-1$. All proper rotations, where such mirroring is not needed, will have a determinant of $+1$.

In other words, the matrix shown by OP is not really a rotation, but a mirroring operation. Considering that there have been both handedness conventions used in 3D computer graphics, it seems to me that the matrix is a combination of a rotation and handedness change, between the file format and the code that loads the data from such files.

One might think that it is wasteful to use an orthonormal matrix here, since really just copying the (optionally negated) coordinate values in a different order would suffice. However, if the code can read data from different file formats, each of which may have their own coordinate axis conventions, the orthonormal matrix approach makes more sense, since it is already used elsewhere in the program (for normal rotations) anyway. Making the coordinate copying with optional negation would require new, additional program code, for essentially no benefit at all. The matrix approach here is a sensible one, although it may feel odd at first. Consider it "conversion from file format coordinate conventions, to the program's own coordinate conventions", and not a rotation per se, just using a (possibly improper, reflection-containing) rotation matrix.