OpenGL Matrices, explanation?

Started by
13 comments, last by Prefect 15 years, 8 months ago
Quote:Original post by Rasmadrak
I disagree. :)
Col x Row.
Every reference I've ever seen on the topic uses the convention RowXCol. I'm pretty sure this convention is used more or less without exception, but if you can provide an example to the contrary I'd be interested to see it.
Advertisement
Quote:Original post by jyk
Quote:Original post by Rasmadrak
I disagree. :)
Col x Row.
Every reference I've ever seen on the topic uses the convention RowXCol. I'm pretty sure this convention is used more or less without exception, but if you can provide an example to the contrary I'd be interested to see it.


This is also the form I have been taught, a matrix which has 4 rows (m) and 3 columns (n) is denoted an m*n or a 4*3 matrix.
Do your references include OpenGL? :)
Quote:Original post by webwraith
Do your references include OpenGL? :)
I assume this is in reference to my post? If so, then yeah, of course they include OpenGL :)

Again, I've never come across a reference (OpenGL or otherwise) that uses the convention Col-Row when referring to matrix dimensions or to individual matrix elements. Can you point me to a reference that contradicts this? (And I'm not being snide - if there is such a reference, I would really like to be aware of it!).

Just to eliminate potential confusion, note that we are talking here about a specific aspect of mathematical notation: whether the row or column is listed first when describing matrix dimensions or specifying a matrix element.

Note that vector notation (row or column) and matrix storage (row- or column-major) are entirely separate and unrelated issues. (I'm guessing this is where you're getting confused...)
I didn't intend to derail this thread in such a way, but since it's at least partially on-topic... the choice of the Rows*Cols notation is not arbitrary.

Say you have two matrices A and B, where A is an m*n matrix and B is a k*l matrix. Then the matrix product A*B is defined iff n = k. When you write it down on paper, you'll see
 A * Bm*n k*l

It gets even more obvious when multiplying more than two matrices. The rule is sometimes formulated as "the inner dimensions of a matrix product must agree". So once you're used to it, everything flows naturally because the definitions are very consistent. [Also, think about how this works with vector-matrix or matrix-vector multiplication.]

Hope this helps in memorizing how things work.
Widelands - laid back, free software strategy

This topic is closed to new replies.

Advertisement