The 3 last values in the transformation attribute are the position of the brick in 3D space XYZ. Simple.
The interesting part is the first 9 values in the transformation attribute
<Rigid refID="0" transformation="0,0,1,0,0.99999910593032837,0,-0.99999988079071045,0,0,-0.39999967813491821,0.40000063180923462,1.2000013589859009" boneRefs="0"/>
They are read as a 3x3 rotation matrix (in-depth explanation: Wikipedia Rotation Matrix)
[a1 a2 a3] [ 0 0 1]
[a3 a4 a5] ==> [ 0 1 0]
[a6 a7 a8] [-1 0 0]
In this case, this is a single rotation around the Y axis, as the axes directions are:
So if you describe the rotation of the brick as yaw, pitch, roll you can say that this matrix describes a 90 degrees yaw clockwise. A 90 degrees yaw counter clockwise is considered a turn of -90 degrees. (clockwise and counter clockwise are probably not the right terms to use here. I am using to make the description easier to understand)
as long as the brick does a single 90 degrees yaw, pitch or roll, it is simple to detect the rotation axis, because there is a single row in the matrix that remains the same, see section Basic Rotations. In the case of rotating around Y axis, the middle row
[0, 1, 0] doesn't change.
Rotating around X axis, keeps the 1st row unchanged
[1, 0, 0]
Rotating around Z axis, keeps the 3rd row unchanged
[0, 0, 1]
So, rotating 90 degrees around the Y axis is (2nd row is 0, 1, 0 as described above)
[Cos90 0 Sin90]
[0 1 0 ]
[-Sin90 0 Cos90]
If the transformation is a combination of rotating around 2 or 3 axes, the matrix is not trivial to read and is a matrix multiplication of 2 or 3 of the above matrices with the respective degree of rotation around each axis.
Turning the brick to 90, 180, 270 degrees in each direction, results in values of 0, 1 or -1 for each cell in the matrix. These are the results for the Sin and Cos functions for 0, 90, 180, 270 degrees.
last point to consider:
If you get values that are not 0, 1, -1 there are two options:
- LDD has a slight miscalculation (This is not a confirmed fact, only my opinion). You can see in the attribute at the top of the post that one of the values is 0.99999... which is basically 1, so it's a 90 degrees turn.
- You turned a LEGO object in an angle which is not a multiplication of 90 (e.g. hat on top of a head turned 30 degrees clockwise)