LH / RH coordinate system

Started by
1 comment, last by Ridcully 23 years, 6 months ago
is there a connection between using a lefthanded / righthanded coordinate system and using row-/column-major matrix format? i am just wondering, because D3D uses a LH coordsys and column-major format, and the book i am currently reading (Real-Time Rendering) uses a RH coordsys and row-major matrix format. that kind of confuses me... rid
Advertisement
rid,
I''m pretty sure that there''s no connection between the handed-ness of the coordinate system and the orientation of the matrices. I believe that the two are independent, and it just so happens that D3D chose to go against the grain in both situations.
The fact is, you can use premultiplication by row vectors (like 3D3) with either left or right handed coordinate systems. The math is the same, regardless of the coordinate system.

Premult by Row Vector : rv2 = rv1 * M
PostMult by Column Vector : cv2 = Mt * cv1
You should be able to convince yourself that these two operations do the exact same math if rv# is the row vector version of cv# and Mt is the transpose of M. The handedness of the coordinate system doesn’t affect matrix math at all.


My personal opinion is that the D3D approach is more intuitive in both cases, but especially with the row vector choice. I think that the left-to-right flow that premultiplication enables is more consistent with integer multiplications. However, there is no question that it is a huge pain in the ass to have this lack of consistency between an API and nearly all of the literature on the subject. In an ideal world, we would have been taught basic linear algebra with row matrices for points (allowing a logical left-to-right multiplication flow for matrix operations).
The lefthandedness of D3D is a harder sell, but I think that it makes more sense for computer graphics, because it allows the Z coordinate to get larger for more distant points.


...Syzygy
In both (D3D or OpenGL) you can use any coordinate system. You just must set proper projection matrix. Conversion between matrix can be done by simple transposing.
I have planes to write layering library between OpenGL and D3D, so I will use these things.

This topic is closed to new replies.

Advertisement