Hard choice

Started by
4 comments, last by ma_hty 16 years, 5 months ago
Hallo. I have hard choice, help me to make it. There are two ways to write down matrix transformations: as row vector (1) and as column vector: (1) (x, y, z, w) (2) ( x ) ( y ) ( z ) ( w ) Tre transormation matrices in this two cases is transposed in respect to each other. In all books, concerning 3D math I see second variant. But in OpenGL you write matrix in memory according to type 1. I want to write 3D/OpenGL articles and thinking about matrix transformation notation. Which version is better up to you?
Advertisement
I would stick with the version that the API that you are dealing with uses.
I do agree with you. But from the point of 3D math,

p * A

looks not great, because we used to apply functions and linear operators like this:

A(p) = A * p

Won't it be a confusion for novices?
Quote:Original post by Phong
Hallo. I have hard choice, help me to make it. There are two ways to write down matrix transformations: as row vector (1) and as column vector:

(1) (x, y, z, w)

(2) ( x )
( y )
( z )
( w )

Tre transormation matrices in this two cases is transposed in respect to each other. In all books, concerning 3D math I see second variant. But in OpenGL you write matrix in memory according to type 1. I want to write 3D/OpenGL articles and thinking about matrix transformation notation. Which version is better up to you?

You can use column vector notation (, in your case option (2)) with OpenGL. You will need a custom written matrix library that operates on column vector matrices. Just make sure you use the library functions instead of OpenGL functions to do all matrix transforms.

Column and Row vector notations are notional conventions. Ideally you should mention which convention is used in your 3D application. I however agree that option (2) is easier to grasp for someone learning 3D math. Vice-versa, for someone learning OpenGL this could be just as confusing. So the choice is up to you really. Your decision would very much depend on what audience your articles want to target.
++ My::Game ++
Quote:Your decision would very much depend on what audience your articles want to target.

Actually the problem is that my articles topic are: 3D math with OpenGL examples :-)
You shouldn't consider your the matrix/vector operation with row vector. Instead, always use column vector notation. And, you can consider OpenGL using column vector notation too.

Let's put it the other way around. Column vector or row vector are only dummy notation. The only issue that matter is how you interprete the contiguous memory block. In OpenGL, contiguous memory block is considered to be column (or we say it is column major). And, column vector notation naturally follows. Column major is something naturally for people doing numerical analysis which favouring the access of each column.

The reason of your confusion is very likely originated from the fact nearly all image formats consider a contiguous memory block as a row of image. Without proper guidelines, people usually consider a contiguous memory block of OpenGL as a row of matrix. Consequencely, we need a row vector with post-multiply matrix operation to make everything in OpenGL make sense. Eventually, the mathematics notation of OpenGL become a mess.

And, whether your have a column major library or a row major library, you can always present your matrix/vector operation using column vector notation.

For more details about row/column major issuse, you can read the article

http://en.wikipedia.org/wiki/Row-major_order

This topic is closed to new replies.

Advertisement