Jump to content
  • Advertisement
Sign in to follow this  
pike168

What exactly is a matrix?

This topic is 3024 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 :-)

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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. >_>

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!