Dear All,
Recently I started to implement the PBRT by reading the first edition of the book. I came to realize that PBRT uses a left-handed coordinate system but still defines positive rotations in a counter-clockwise fashion (see Figure 2.10 on page 72). To be more specific, positive angles are associated with counter-clockwise rotations when viewing the system along the negative direction of the axis of rotation.
In this case, the rotation around the x-axis equation given in page 71 and its implementation on page 72 seem incorrect to me. These equations look like this:
1 0 0 0
0 ct -st 0
0 st ct 0
0 0 0 1
where ct = cos(theta) and st = sin(theta).
To explain the problem, let's use the example in Figure 2.10 (page 72). Here, if we rotate a vector along the positive-z axis 90 degrees counter-clockwise around the positive x-axis, it should align with the positive y-axis. In other words [0 0 1 0]^T should map to [0 1 0 0]^T (please correct me if I am missing something here). Now, if we plug in cos(90) and sin(90) to the above matrix, it will give us:
1 0 0 0
0 0 -1 0
0 1 0 0
0 0 0 1
If we multiply this matrix with [0 0 1 0]^T it will give us [0 -1 0 0]^T. This could only be correct if the rotation was performed clockwise.
So if the above logic is not wrong, I believe that are two possibilities:
1) Either the PBRT defines positive rotations clockwise, in which case Figure 2.10 is erroneous (Figure 2.11 would also be erroneous in this case)
2) The rotation matrices are defined incorrectly (which seem almost impossible to me given how widely PBRT is used)
I would very much appreciate your comments on this issue. It is quite possible that my understanding of the topic is flawed as well but please show me the error in my arguments if this is the case.
(I've checked the bug reports but could not find anything specific about this so I decided to post here).
Ahmet Oguz Akyuz