home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / graphics / 14127 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  3.0 KB

  1. Xref: sparky comp.graphics:14127 comp.windows.x.pex:691 comp.graphics.opengl:270
  2. Path: sparky!uunet!psinntp!eye!erich
  3. From: erich@eye.com (Eric Haines)
  4. Newsgroups: comp.graphics,comp.windows.x.pex,comp.graphics.opengl
  5. Subject: Row major or column major matrices?
  6. Message-ID: <1993Jan22.124249.3817@eye.com>
  7. Date: Fri, 22 Jan 93 17:42:48 GMT
  8. Sender: erich@eye.com (Eric Haines)
  9. Organization: 3D/EYE, Inc.  Ithaca, NY
  10. Lines: 57
  11.  
  12. I feel vaguely like I'm in a twilight zone episode.  You know, like the ones
  13. where some guy wakes up and finds that all the lettering is backwards and
  14. everyone is left-handed.
  15.  
  16. Someone was telling me that OpenGL allows only post-concatenation of matrices.
  17. This seemed bass-ackwards, and after a few minutes reconfirming in my slow
  18. turtle brain that you'd normally want pre-concatenation of matrices, I read
  19. over the OpenGL manual page carefully.  Aha, they store matrices in
  20. column-major form:
  21.  
  22.     a0   a4   a8   a12    a typical    1  0  0 -2
  23.     a1   a5   a9   a13    translation    0  1  0  5
  24.     a2   a6   a10  a14    matrix -->    0  0  1  3
  25.     a3   a7   a11  a15            0  0  0  1
  26.  
  27. Me, I learned on my pappy's knee (well, actually, through Newman & Sproull) to
  28. use row major matrices.  Up until today using column major matrices never
  29. crossed my mind.  Anywell, ideas like "we only post-concatenate column major
  30. matrices" translates into "we only pre-concatenate row major matrices".
  31. Lovely, a new way to confuse computer graphics people (as if left vs.
  32. right-handed coordinate systems weren't bad enough).  This is not a slam of
  33. OpenGL - Phigs uses column major matrices, too!
  34.  
  35. It's admittedly a minor point, and really just a notational difference - the
  36. matrices are just the same, of course.  As long as you get the matrix elements
  37. in the right order it doesn't matter to the computer.  It's just writing it
  38. down on paper and presenting it is where the difference appears.
  39.  
  40. Just out of curiosity, I looked at a few computer graphics books and whatnot
  41. and how they presented 3D matrices.
  42.  
  43. Row Major users:
  44.  
  45.     Foley & VD (1st edition), Newman & Sproull, Graphics Gems series,
  46.     Rogers books, Watt, Burger & Gillies, the Thalmanns, HP Starbase
  47.  
  48. Column Major users:
  49.  
  50.     Foley & VD & F & H (2nd edition), OpenGL, Phigs (and PEX, I assume)
  51.  
  52. So Foley et al is the only book I could find that uses column-major matrices.
  53. Weirder yet, the first edition of Foley & VD uses the row-major form, but then
  54. the second edition goes to column-major form!  Evidently this book's second
  55. edition made quite an impression (or maybe just reflects some new teaching
  56. methods present at the time), since both OpenGL and PEX adopted it, in
  57. contrast with the rest of the research and academic community who (seem to)
  58. use row-major matrices.
  59.  
  60. If you made it this far, take a minute and hit that "r" key and let me know
  61. which form (if either) you prefer, where you learned it, and any other
  62. insights you might have.  I'm interested to see if there's any correlation
  63. with school, or age, or whatever.  I'll summarize to the net.
  64.  
  65. Thanks, and not that I'm biased or anything, but dismemberment and death to all
  66. column-major users,
  67.  
  68. Eric Haines
  69.