What exactly is a matrix?

Started by
15 comments, last by alvaro 14 years, 1 month ago
I am currently using the OpenGL and OpenSceneGraph API's to do some uni work and although i am still just learn the basics such as composing primitives, GL states and lighting there has been something bugging me for a while now. When i have to rotate or translate objects the documentation that i am using always refers to the matrix, I hate to sound stupid but what actually is a, or the matrix? So, for people who actually have an understanding of computer graphics, how would you define what the matrix actually is? Thanks for any input and apologies if my question is confusing :-)
Advertisement
http://en.wikipedia.org/wiki/Matrix_(mathematics)

Google is your friend.
While a definite answer to your question could fill one thousand textbooks, this might help to get you started:

http://www.sjbaker.org/steve/omniv/matrices_can_be_your_friends.html

What you really want to look up is an introduction to "Linear Algebra", this entire field of mathematics is devoted to study of matrices.
[size=2]My Projects:
[size=2]Portfolio Map for Android - Free Visual Portfolio Tracker
[size=2]Electron Flux for Android - Free Puzzle/Logic Game
Nobody can be told what matrix is....

PS: Sorry
It's like a Sudoku.
"It's like naming him Asskicker Monstertrucktits O'Ninja" -Khaiy

Symbolically, a matrix is just a way to hold the coefficients of a solution of m equations involving n unknowns (m x n matrix).

However, in linear algebra, we can also define a matrix to be a list of n vectors in R^n space.

Ex:
[ 1 2 3 ]
[ 3 1 7 ]
[ 2 9 6 ]

Can be understood as the coefficient matrix of a system of equations or as the three vectors, a1, a2, and a3, where a1 is the first column, a2 the second, and a3 the third.

There are a number of operations we can do with matrices, but these only make sense if you understand that as a system of vectors, a matrix is a transformation of the vector you are multiplying from R^n space to R^m space.

In graphics programming, we typically use a 4 x 4 matrix, which means when we multiply an R^4 vector by a matrix, a transformation occurs, producing a vector also in R^4 space.

Ex: A(m x n matrix) * b(R^n vector) = c(R^m vector)

If you consider matrices transformations, then we can describe the multiplication of matrices as the composition of transformations, just like when we compose functions. And just like the composition of functions, order matters.

Ex: g(f(x)) != f(g(x))
AB != BA (generally)

In graphics programming matrices are primarily used as transformations (or functions) that take a vector and produce a vector. By multiplying (composing) matrices, we can reduce the number of multiplications each vector needs.

For a more complete definition, Google is your friend, but a text would be better. I purchased a text on linear algebra at Half Price Book Store for $4.99 (no joke) for my class this semester.
Quote:Original post by Antheus
Nobody can be told what matrix is....

My thoughts exactly [grin]

To maintain some semblance of useful posting, I personally found this math primer a nice accessible starting point on what vertices and matrices are and how they work.
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
Quote:Original post by karwosts
What you really want to look up is an introduction to "Linear Algebra", this entire field of mathematics is devoted to study of matrices.

Linear Algebra also encompasses systems of linear equations, et al. Matrices are, as far as my understanding goes, just a helpful data structure/notation.

Unless I'm totally studying the wrong thing in preparation for my mathematics units at uni. >_>
Quote:Original post by Fenrisulvur
Linear Algebra also encompasses systems of linear equations, et al. Matrices are, as far as my understanding goes, just a helpful data structure/notation.

Unless I'm totally studying the wrong thing in preparation for my mathematics units at uni. >_>


No worries, at least my uni course back in the day started with systems of linear equations after the preliminaries. Later on it tapered off into vagueness with vector spaces, which is the part heavily used in computer graphics.

For an accurate treatise check out the link above, but the basic idea is that a matrix can transform vectors from one vector space to another. So you can use a matrix to stick your model vertices in a coordinate system that is for example translated or rotated wrt the base coordinate system (typically called world space).
Rim van Wersch [ MDXInfo ] [ XNAInfo ] [ YouTube ] - Do yourself a favor and bookmark this excellent free online D3D/shader book!
It's just a grid, that's all it means. It has many complex uses but it's literally just a grid of numbers, 2 dimensional (width and height).

This topic is closed to new replies.

Advertisement